Jump to content


  • Content count

  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

1 Neutral

About berkhak

  • Rank

Contact Methods

  • Website URL

Personal Information

  • Name
  • Location
    San Francisco

Recent Profile Visitors

1,718 profile views
  1. Interrupt SOP Cooking with time limit (Python)

    Hi, Great idea than one can wrap the node verb function around a decorator to limit the cook time. Found this tread that help me implement the decorator if anyone else is interested: https://stackoverflow.com/questions/492519/timeout-on-a-function-call Test Code for Houdini: import sys import threading from time import sleep try: import thread except ImportError: import _thread as thread def quit_function(fn_name): print(str(fn_name) + ' took too long') thread.interrupt_main() # raises KeyboardInterrupt def exit_after(s): def outer(fn): def inner(*args, **kwargs): timer = threading.Timer(s, quit_function, args=[fn.__name__]) timer.start() try: result = fn(*args, **kwargs) finally: timer.cancel() return result return inner return outer @exit_after(2) def countdown(n): # some function that can be run within Python SOP print('countdown started') for i in range(n, -1, -1): print(str(i) + ', ') sleep(1) print('countdown finished') try: countdown(5) except: print('do something else') Tesekkurler Yunus!
  2. I am curious if it is possible to clock how long it takes to cook a surface operator and interrupt if it goes above a certain limit, preferably within a python SOP? Backstory; there are cases when a polyexpand2D node takes excessively long time to cook. I've contacted SideFX for this unexpected behavior. Long story short, this is what they recommended: And it does, when you translate the input geometry of the ‘polyexpand2d’ SOP the results do vary. So now I am trying to figure out a way to clock a particular section of the network tree, and if it takes longer than X amount of time, I want to translate the input ever so slightly. Hopefully this will help it so it doesn't take +1 hour to cook (average is somewhere between 1-5 seconds). I have been looking into hou.perfMon but that didn't really lead me anywhere. Let me know if anyone has any suggestions. Pseudo Code: import time trans_node = hou.node("../translate1") cook_node = hou.node("../COOK_THIS") start = time.time() time_limit = 5.0 rot= 0.0 while current_time < time_limit: try: cook_node.cook() except Timeout: rot= random(0.0, 360.0) trans_node.parm("rx").set(rot) cook_node.cook() continue Thank you!
  3. Indeed that is kinda the behavior that you need to follow in order to create tab folders or radio buttons. I have been trying to figure out how to put folder group with parameters and sub-folders into an already existing folder. Have you done anything like that? It looks like, you can't just stack `parm_template_group.appendToFolder(target_folder, source_folder)` one after another if I want to include two folder in an existing one. I guess I need to have a parmTemplateGroup() for each folder.
  4. Yes, I happen to separate the actions as well. It does seem like Side Effects tag this behavior to a illegal operation. This env variable will stop the error from popping up but I dont think it is recommended: HOUDINI_ERROR_ON_ILLEGAL_NODE_EDITS := 1
  5. 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
  6. Hi everyone, I have recently start looking into glTP files. It looks really promising to introduce to the pipeline. So I have a question, although I was able to successfully import geo to SOP level; I had no luck getting the File> Import > GLTF Scene to working. I keep getting the "Failed to Import `...../geo.gltf` error. Has anyone got it working yet? Thank you!
  7. custom transform pieces

    Great stuff guys! Hey petz, I was trying to write something like this for a while. Love your method. I have a question, do you think it is possiable to do the matrix transform by the macthing name attr? Instead of prim-uv? Best, Berk.
  8. Yes, just like you said it faster to use blast then removeing geo in VEX, thanks guys. Almost twice as much: (7M points)
  9. Yes, indeed the blast SOP is faster. I have been doing the same way so far too. I was just wondering if one step was possible. Thanks for the answer! Alright, I will do a test to see which one is faster. I ll post the results! Thanks again!
  10. Hey guys, I was wondering if anyone knows how to delete rand points/prims with `rand()` in blast SOP. For some reason I couldn't get it to work: `rand(@ptnum)`>0.5 so I did this.. @id>`fit(0.5,0,1,1,npoints(opinputpath(".",0)))` but I guess there are chases where I dont/cant use id. Thanks!
  11. Quick scripting question...

    Thanks a lot, my mistake, cheers.
  12. Quick scripting question...

    Hi guys, I couldnt figure out something, need your help. So I want to pre scale individual primitives with foreach sop before generating the voronoi fracturing (it is a wood mesh). The classic work flow, scale it down so can get the splinter look when you scale it back after the fracturing. So I just want to make sure I control pre scale the each individual piece by their longest side. Thats kinda it, I ve been trying to do it with vopsop and attrwrangle but I just couldnt make it work correctly. I would much appreciate some help. Thanks! I was going for this kinda solution. Change the name of the string that I might use to scale, and compare the each axis with each other.. but again if you guys know a better way, Im ready to learn. s@mysizeName = "X"; if ( v@sizeAttr.z > v@sizeAttr.x ||v@sizeAttr.z >v@sizeAttr.y) s@mysizeName = "Z"; else s@mysizeName = s@mysizeName; if (v@sizeAttr.x >v@sizeAttr.y ||v@sizeAttr.x >v@sizeAttr.z) s@mysizeName = "X"; else s@mysizeName = s@mysizeName; if (v@sizeAttr.y >v@sizeAttr.x ||v@sizeAttr.y >v@sizeAttr.z) s@mysizeName = "Y"; else s@mysizeName = s@mysizeName;
  13. Hello Everyone, I m roughly a newbie to Houdini and I've been working on a student project where this sewer is being flooded. The water sim is done, now I want to put up some white water and mist, but I'm having hard time to make it work. I'm using the shelf tool so it should be pretty straight forward, but some how the white water/mist emission looks broken. It almost looks like the ww/mist emission only emits from the geo that I've use to emit the water. ( you can see at below, when you visualize the surface of the emission from the whitewater source node, I only get the geo that I previously used at the water sim.) I've tired my best but nothing really looks like making a progress. Maybe one of you can point out my problem. I would much appreciate if you guys have the time to help me out. Best regards.. Berk. (Expect my apologies if I've done any mistakes since its my first first )