Jump to content
sebkaine

How to enter my code presets in a Wrangle ?

Recommended Posts

Hi Guys,

There is now this great menu at the right of the text field where you can use code presets inside a wrangle.

I would like to know where i can customise this code and enter my own presets.

 

Thanks for your lights !

Cheers 

E

 

 

custom_vex.jpg

Share this post


Link to post
Share on other sites

 

Under installed Houdini there is the File: VEXpressions.txt

Copy to your User Path and edit it. 

Have Fun. :-)

VEXpressions.png

 

EDIT:

No Fun i didn't get it to run with a seperated File VEXpressions.txt. I also have seen that Houdini has a Python code That loads the list but it doesn't load my values. *arrrggghh*

i do something wrong but i don't know what.....

Python Code under: vexpressionmenu.py

you can run it in Python Shell: 

# Python Code
import vexpressionmenu as v
v.loadSnippets()

 

Edited by Mandrake0
  • Like 1

Share this post


Link to post
Share on other sites

I could have sworn I saw it in the docs, but the only references google returns are from the sidefx forum and odforce. Anyway.

Create a file called vexpressions.txt in your ~/houdini folder, put your snippets in there. There's a slightly odd formatting to use, not too bad. Eg, I just tested this:

 

attribwrangle/snippet
    delete x% of points with slider
	    if (rand(@ptnum)< ch('threshold')) {
			removepoint(0,@ptnum);
		}

The indentation determines what the category/comment/code is, its documented within the example vexpressions.txt file which you can find by running this in the houdini python shell:

hou.findFiles('vexpressions.txt')

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot for all your answers guys, this is really a big plus ,

i can't count the number of time i write pcopen in a single day ...:)

Share this post


Link to post
Share on other sites

Not sure how those presets work, but saving presets with the Gear icon saves all extra parameters and stuff you've added as well. Kinda nice if you made an asset-sort-of-thing but as a preset.

Share this post


Link to post
Share on other sites

edit parameter interface, "Vexexpression", parameter description "Menu",  "vexpressionmenu" is under Houdini 15.5.480\houdini\python2.7libs

 

 

Edited by deniz

Share this post


Link to post
Share on other sites
20 hours ago, mestela said:

I could have sworn I saw it in the docs, but the only references google returns are from the sidefx forum and odforce. Anyway.

Create a file called vexpressions.txt in your ~/houdini folder, put your snippets in there. There's a slightly odd formatting to use, not too bad. Eg, I just tested this:

 


attribwrangle/snippet
    delete x% of points with slider
	    if (rand(@ptnum)< ch('threshold')) {
			removepoint(0,@ptnum);
		}

The indentation determines what the category/comment/code is, its documented within the example vexpressions.txt file which you can find by running this in the houdini python shell:

hou.findFiles('vexpressions.txt')

 

'vexpressions.txt' file name doesn't work for me but VEXpressions.tx is ok !!

Thanks

Share this post


Link to post
Share on other sites
1 hour ago, dedeks3000 said:

'vexpressions.txt' file name doesn't work for me but VEXpressions.tx is ok !!

Thanks

 

it need to be VEXpressions.txt otherwise the hou.findFiles won't find it.

Python Code (vexpressionmenu.py):

def loadSnippets():
    """ Loads all the vexpressions from the VEXpression.txt
        files found in the houdini path.
    """
    try:
        filelist = hou.findFiles('VEXpressions.txt')

....

 

Share this post


Link to post
Share on other sites

Hi

You actually don't have to do that funky indentation to make this work, but you have to omit special characters like %:

attribwrangle/snippet
    delete x% of points with slider
	    if (rand(@ptnum)< ch('threshold')) {
			removepoint(0,@ptnum);
		}

 

If you write it like this it'll work and you'll get the indentation you put into the snippet:

attribwrangle/snippet
    Delete x of points with slider
    if (rand(@ptnum)< ch('threshold')) {
    	removepoint(0,@ptnum);
    }

-b

 

PS i wish the Code -> No formatting could be changed from black text on dark gray background. Doesn't have to be fancy. Just readable :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×