Jump to content

How to enter my code presets in a Wrangle ?


sebkaine

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

Link to comment
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
Link to comment
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
Link to comment
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

Link to comment
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')

....

 

Link to comment
Share on other sites

  • 2 months later...

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 :)

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...