Jump to content

Editing String parameter using other parameter


Recommended Posts

I have a file node with the Geometry File parameter set to /home/Houdini/bgeo/geo1_lod_$F.bgeo so that it's capable of reading .bgeo files with different levels of detail at different frames.

 

What I would like to do is instead of having the LoD change with the frame number, I would like to have an integer parameter called "Level of Detail" or "lod" control the file selected.

 

I understand that it is possible to add an expression in the file param that goes /home/Houdini/bgeo/geo1_lod_'ch("control/lod)'.bgeo, but in the event that I have to change the geometry (geo2_lod_0.bgeo, geo3_lod_0.bgeo) I would have to add the expression each time.

 

I'm wondering if there's a way to replace the $F portion of the file string with the expression 'ch("control/lod)' maybe via an intermediate process (button?) so that I could change the geometry, run that process, then change the value on the "lod" parameter to select different sub-geometries.

 

I'm open to Python/Hscript if it makes my life easier in the long run... (Lots of geometry choices to go through here)

 

Edit: I've come across what seems like a similar question at link. Hope this leads to my solution!

Edited by Fenolis
Link to comment
Share on other sites

I don't quite I understand the problem. Are you changing the names of the files or are you changing the content of the files? If you're changing the names, then it's just a matter of augmenting your path with the appropriate expression to another parameter. Changing the value of the filenames will automatically cause it to reload. If you're changing the content without the changing the names, then you can just hit the Reload button on the File SOP (or link it to another button on your HDA).

Link to comment
Share on other sites

I'm trying to change the name of the files. The files are named based on a geo#, then further split into levels of detail like:

geo1_lod0

geo1_lod1

geo2_lod0

geo2_lod1

 

What I would like is for some way to find the "lod#" portion in the file name and replace it with the expression linking it to my parameter, so that a file named geo1_lod$F would become geo1_lod'ch("control/lod)'

Link to comment
Share on other sites

Yes, that works for most of my cases. But I suppose I did not clarify well in the last post, sorry.

 

What I meant was, the naming convention goes:

file1/geo1_v1_lod0.bgeo

file1/geo1_v1_lod1.bgeo

file1/geo1_v2_lod0.bgeo

file1/geo1_v2_lod1.bgeo

file1/geo2_v1_lod0.bgeo

file1/geo2_v1_lod1.bgeo

file2/geo1_lod0.bgeo

file2/geo1_lod1.bgeo

file2/geo2_lod0.bgeo

file2/geo2_lod1.bgeo

file3/geo1_v1_lod0.bgeo

file3/geo1_v1_lod1.bgeo

 

As you can see the file names are roughly similar but they are stored in different folders by design type, some don't have version numbers. The user would be able to navigate to the desired folder and choose a geometry + version type, then using a parameter control to change the "lod#" Since the file name is specified manually I cannot use expressions directly in the parameter, so I would like for a button sort of control to replace the lod# part of the file name with lod'ch("control/lod)'

 

Is this possible?

(Thanks for your time, by the way!)

Link to comment
Share on other sites

Sure, so you have a button which has a callback script that does a python regex replacement for "lod[0-9]" with `ch("/control/lod)` ... You might also be able to do the callback script on the file parameter itself (YMMV).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...