I'm repeating my question from odforce thread here to emphasize my curious:
Am I wrong or hscript can not save matrix to variable?
Code like this:
set lookat = normalize(vector3(0,0,-1) * (rotate($RX, “x”) * rotate($RY, “y”) * rotate($RZ, “z”)))
doesn't work divided into sections… only in one expression.
Something like: $myvector * $mymatrix * $mymatrix is not allowed?
Thanks for enlightenment!
sy.
matrix to variable
3704 4 2- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
I belive hscript only supports floats, int's and strings.
Expressions on the other hand can support all the data types in Houdini. Check out the expression language help in the docs.
All parameters can take expression functions directly as well. As long as you return the data type supported by the parm that you are in. In this special case, simply omit the expression function declaration and simply write the expression inside the curly braces.
Expressions on the other hand can support all the data types in Houdini. Check out the expression language help in the docs.
All parameters can take expression functions directly as well. As long as you return the data type supported by the parm that you are in. In this special case, simply omit the expression function declaration and simply write the expression inside the curly braces.
There's at least one school like the old school!
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
- wolfwood
- Member
- 4262 posts
- Joined: July 2005
- Offline
There are two different things here, the expression language and hscript.
The expression language supports a matrix type.
{
vector p = vector3(0,5,0);
matrix m = identity(4);
matrix trans = translate(0,5,0);
p = p * m * trans;
return p;
## Returns 10
}
Unlike the expression language hscript doesn't have any types at all. It works just like the csh where you assign some string to a variable. Since everything is just a string you have to specify your variable type every time you use it.
set p = `vector3(0,5,0)`
set m = `identity(4)`
set trans = `translate(0,5,0)`
set p = `vector($p) * matrix($m) * matrix($trans)`
echo `vector($p)`
## Returns 10
The moral of the story is to keep everything in the expression language as much as possible, but if you do have to use hscript it should be doable.
The expression language supports a matrix type.
{
vector p = vector3(0,5,0);
matrix m = identity(4);
matrix trans = translate(0,5,0);
p = p * m * trans;
return p;
## Returns 10
}
Unlike the expression language hscript doesn't have any types at all. It works just like the csh where you assign some string to a variable. Since everything is just a string you have to specify your variable type every time you use it.
set p = `vector3(0,5,0)`
set m = `identity(4)`
set trans = `translate(0,5,0)`
set p = `vector($p) * matrix($m) * matrix($trans)`
echo `vector($p)`
## Returns 10
The moral of the story is to keep everything in the expression language as much as possible, but if you do have to use hscript it should be doable.
if(coffees<2,round(float),float)
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
-
- Quick Links