sant0s81 Posted May 17, 2020 Share Posted May 17, 2020 (edited) Hi, for learning purpose I would like to create a folder structure on my harddrive by clicking a button parameter. I found examples on how to create new folders in the parameter interface - but not how to do that on the HDD. Actually I was thinking about adding a "string parameter" (or using "multiparm block list") to write a name and than use that parameter, to create a folder with that name after clicking on the "button parameter". Is that possible with the callback script or does that make absolutly no sense? Thx! Edit: I also just found examples with a TOP network. Does a great job. Wonder, if I can start the "cooking" process with a Button Parameter. Edited May 28, 2020 by sant0s81 Quote Link to comment Share on other sites More sharing options...
gemini Posted May 17, 2020 Share Posted May 17, 2020 Hi, Try something similar: import os f_num = hou.evalParm('/obj/geo1/null/folder_parm') for idx in range( 1,f_num+1): os.makedirs( os.path.join( 'a:', os.sep, 'temp', hou.evalParm('/obj/geo1/null/folder'+str(idx)))) 1 Quote Link to comment Share on other sites More sharing options...
sant0s81 Posted May 17, 2020 Author Share Posted May 17, 2020 @gemini, thx alot, works almost perfect for me When I create the NULL and add a string parameter (Language set to Python) to get the script window, I dont get the "Run" parameter you have and its not executing. When I use a Python Sop, your code example works and creates the folders - but its looping all the time and gives me an error, that the folder alreay exists. Is there something in the Parameter Settings, that I have to add to get the "Run" parm? Anyway, thx again for the example, helps alot! Quote Link to comment Share on other sites More sharing options...
gemini Posted May 17, 2020 Share Posted May 17, 2020 Use this as a callback: 1 Quote Link to comment Share on other sites More sharing options...
sant0s81 Posted May 18, 2020 Author Share Posted May 18, 2020 (edited) Thank you very much again @gemini Just to finish the topic: I modified the code a bit to add a path an project name. I dont know if that is the best way. If I can optimize the code, would like to know how Thx alot, sant0s Edited May 18, 2020 by sant0s81 Quote Link to comment Share on other sites More sharing options...
sant0s81 Posted May 21, 2020 Author Share Posted May 21, 2020 (edited) Morning have one more question: I would like to use toggles to pass over the names to os.makedirs . But whatever I do, I never get the marked toggles and always only the first. I understand, that the "Multiparm Blocklist" has an ID - but when I change the Folder Type to simple, I have no idea how to pass over the toggles since there is no more ID. And something else I wonder how to do that: how could I create a list of folder presets and pass them over? Thanks alot! edit: In this line here I dont know, how to choose all parameters instead of "folder" hou.evalParm('../null/folder'+str(idx)))) Of course "folder" is wrong - but I tried stuff like "*" to choose all. But of course, not working Edited May 21, 2020 by sant0s81 Quote Link to comment Share on other sites More sharing options...
sant0s81 Posted May 21, 2020 Author Share Posted May 21, 2020 I did some research and I think I have to give a callback script to each toggle parameter, to send the parameters name. Is that the right direction? Something like transfering each toggle parameter into a function that reacts on the callback script. Dont even find words what I wanna do, sry Quote Link to comment Share on other sites More sharing options...
sant0s81 Posted May 22, 2020 Author Share Posted May 22, 2020 (edited) I am just trying parameters from the Redshift_ROP. They also use the Multiparm Block (list) to choose the different AOVs. In the Redshift_ROP, as soon as I choose an AOV like Diffuse, the string textblock changes the name to Diffuse, too. I copied these parameters to see what they did. But as soon as I copy the parameters to my new geometry, the text stays on the default value and is not changing automaticly. Is there something missing? I add the hip below. create_folders_v001c.hiplc Edited May 22, 2020 by sant0s81 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.