I'd like to add a new generically accessible custom function that I've been including in attributewrangle expressions.
This new function needs to be accessible in transform channel expressions as well.
Is there a way to do this without creating a plugin?
As is described here:
https://www.sidefx.com/docs/hdk/_h_d_k__intro__creating_plugins.html [www.sidefx.com]
adding a custom vex function to houdini
1547 5 1- WillA
- Member
- 98 posts
- Joined: July 2005
- Offline
- jsmack
- Member
- 7801 posts
- Joined: Sept. 2011
- Offline
- WillA
- Member
- 98 posts
- Joined: July 2005
- Offline
Yeah, I've started exploring creating a plugin so I can share a custom sin wave cycle function I'm working on.
It's basically a sin wave but can flatten the peaks.
Here is the python code.
I will add the VEX code to this post which can be used in an attributewrangle sop.
import numpy as np
def sinflatten(t, amplitude, frequency, flattenamount):
bsquared = flattenamount * flattenamount
sinval = np.sin(2 * np.pi * (t/frequency))
sinvalsquared = sinval * sinval
sqrtval = np.sqrt( (1.0 + bsquared) / (1.0 + bsquared * sinvalsquared) )
yval = sqrtval * sinval
return amplitude * yval
t = np.linspace(0, 60, 600)
init_amplitude = 5
init_frequency = 10.0
init_flattenamount = 0
sinflatten(t, init_amplitude, init_frequency, init_flattenamount)
It's basically a sin wave but can flatten the peaks.
Here is the python code.
I will add the VEX code to this post which can be used in an attributewrangle sop.
def sinflatten(t, amplitude, frequency, flattenamount):
bsquared = flattenamount * flattenamount
sinval = np.sin(2 * np.pi * (t/frequency))
sinvalsquared = sinval * sinval
sqrtval = np.sqrt( (1.0 + bsquared) / (1.0 + bsquared * sinvalsquared) )
yval = sqrtval * sinval
return amplitude * yval
t = np.linspace(0, 60, 600)
init_amplitude = 5
init_frequency = 10.0
init_flattenamount = 0
sinflatten(t, init_amplitude, init_frequency, init_flattenamount)
- tamte
- Member
- 8584 posts
- Joined: July 2007
- Offline
- WillA
- Member
- 98 posts
- Joined: July 2005
- Offline
- tamte
- Member
- 8584 posts
- Joined: July 2007
- Offline
WillASo would your compiled plugin
Well, the text file referred to by #include would have to be placed in a convenient path location.
However it's quite straightforward to make a package containing all the files for your extension, so as long as your .h files are in vex/include folder of your package you will be fine
WillANo, but they are also not VEX, so may need to be treated as a separate codepath anyway
Also, I don't think #include can be used in channel expressions for transform sops.
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links