I came across this expression which sources a value and want to know what the “0” is for (after “iteration”,)?
rand(detail(“../foreach_begin3_metadata1/”,“iteration”, 0)) < 0.25
detail expression query
4427 10 1- litote
- Member
- 209 posts
- Joined: July 2013
- Offline
- tamte
- Member
- 8449 posts
- Joined: July 2007
- Offline
It's an attribute component index
While help for detail() function doesn't explain much, it's explained well in point() function help
https://www.sidefx.com/docs/houdini/expressions/point.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/expressions/detail.html [www.sidefx.com]
While help for detail() function doesn't explain much, it's explained well in point() function help
https://www.sidefx.com/docs/houdini/expressions/point.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/expressions/detail.html [www.sidefx.com]
Edited by tamte - Jan. 18, 2020 09:58:44
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- litote
- Member
- 209 posts
- Joined: July 2013
- Offline
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
- litote
- Member
- 209 posts
- Joined: July 2013
- Offline
@Babaj: The link he gave provides only an obscure, secondhand reference:
“index specifies the component position in multi-component attributes such as vectors, colors, and arrays. For example, if the attribute is a color, an index value of 0 returns the red component, 1 returns the green component, and 2 returns the blue component.”
It does not relate to my example and does not answer my question, nor is it clear, for example what “component position” relates to.
What is the point of your post? If you can provide an answer, that is the purpose of this forum rather than to be snide.
“index specifies the component position in multi-component attributes such as vectors, colors, and arrays. For example, if the attribute is a color, an index value of 0 returns the red component, 1 returns the green component, and 2 returns the blue component.”
It does not relate to my example and does not answer my question, nor is it clear, for example what “component position” relates to.
What is the point of your post? If you can provide an answer, that is the purpose of this forum rather than to be snide.
- litote
- Member
- 209 posts
- Joined: July 2013
- Offline
According to another post (it seems to have been deleted), the “0” is “the default value DETAIL will use if it can't get a valid value from the object”, which tallies with what I thought it might be.
This is not mentioned in the link above, btw (Babaj). If anyone would like to confirm this is correct, feel free to post.
This is not mentioned in the link above, btw (Babaj). If anyone would like to confirm this is correct, feel free to post.
- tamte
- Member
- 8449 posts
- Joined: July 2007
- Offline
litoteIf there was such answer and it's now deleted it's probably because it's incorrect
According to another post (it seems to have been deleted), the “0” is “the default value DETAIL will use if it can't get a valid value from the object”, which tallies with what I thought it might be.
This is not mentioned in the link above, btw (Babaj). If anyone would like to confirm this is correct, feel free to post.
the help page is pretty descriptive, however it requires some prior knowledge (like undestanding what a component of a vector, or array attribute value is)
detail() expression function returns only a scalar value, single number
if your detail attribute is vector or array it will consist of multiple scalar values like {2.3, 4.7, 2}…
0 is simply an index specifying which value to pick
0 will pick first, which in case of example vector {2.3, 4.7, 2} will be 2.3
1 second, 4.7
2 third, 2
etc …
If your detail attribute is already a scalar value (float or int) then specifying index is sort of meaningless, but since detail() expression function expects it, you still have to put something in there, usually 0
Also for string values you'll need to use details() function, which unfortunately doesn't allow for specifying the index, so it's not possible to read specific values from string array attribites
Edited by tamte - Jan. 18, 2020 22:19:44
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- litote
- Member
- 209 posts
- Joined: July 2013
- Offline
Thanks so much Thomas! Greatly appreciated.
That makes it much clearer and also aligns with a reference another guru made in a tutorial. I think you are right about the deleted comment probably being mistaken.
It (almost) restores my faith in humanity when people like yourself offer to help neophytes like myself. You are all magicians as Method Studios.
That makes it much clearer and also aligns with a reference another guru made in a tutorial. I think you are right about the deleted comment probably being mistaken.
It (almost) restores my faith in humanity when people like yourself offer to help neophytes like myself. You are all magicians as Method Studios.
- vusta
- Member
- 555 posts
- Joined: Feb. 2017
- Offline
it was me with the deleted post…I swear I remember that's how things work….but I was fumbling around with a test after the post and couldn't be stuffed setting up a test scene.
I reckon it's me watching some videos of some dude explaining the use of detail, and I just took their word for it that that's what the 0 is for…
but I think it might be this:
These functions take an additional argument. The functions will overwrite the integer variable you pass to this argument with 1 if the read succeeded or 0 if it failed. This lets you distinguish when the function returns 0 because the attribute value is actually zero, or because the read failed.
aha, now we're more confused:
ignored
The last argument is always ignored. It is just there so you can change a prim/point/vertex call (which each have an element number argument) to a detail call by changing the name without having to change the arguments as well.
well don't shoot the messenger…
I reckon it's me watching some videos of some dude explaining the use of detail, and I just took their word for it that that's what the 0 is for…
but I think it might be this:
These functions take an additional argument. The functions will overwrite the integer variable you pass to this argument with 1 if the read succeeded or 0 if it failed. This lets you distinguish when the function returns 0 because the attribute value is actually zero, or because the read failed.
aha, now we're more confused:
ignored
The last argument is always ignored. It is just there so you can change a prim/point/vertex call (which each have an element number argument) to a detail call by changing the name without having to change the arguments as well.
well don't shoot the messenger…
Edited by vusta - Jan. 19, 2020 00:56:00
- litote
- Member
- 209 posts
- Joined: July 2013
- Offline
- tamte
- Member
- 8449 posts
- Joined: July 2007
- Offline
vusta
The last argument is always ignored. It is just there so you can change a prim/point/vertex call (which each have an element number argument) to a detail call by changing the name without having to change the arguments as well.
at this point it's important to make a distinction
what you are talking about is detail() VEX function
the thread title (also the code snippet in the first post) suggests we are talking about detail() expression function
for detail() VEX function if the 3rd argument is specified, it will be ignored altogether, however you can also use just 2 arguments
in case of detail() HScript expression function, this still applies https://www.sidefx.com/forum/topic/71592/#post-303412 [www.sidefx.com]
Edited by tamte - Jan. 19, 2020 02:24:53
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links