in texport , i typed:
set globalvar1=1
set globalvar2=2
set globalvar3=3
then inside my expression, try to load the data using these :
float total =0;
for (i=1;i<4;i++){
string strvar = “\$globalvar”+i;
total += run(“echo ”+strvar);
}
return total;
it doesn't work, so the expression :
-> total += run(“echo ”+strvar)
is giving the wrong value. And as an alternative , i tried using :
-> total += eval(strvar);
still doesn't work. coz ‘eval’ will give an error when hitting ‘$’ character inside the parameter.
Does anyone know how to make it work?
thanx
global var in expression
4095 2 1- metaclay
- Member
- 122 posts
- Joined: May 2006
- Offline
- thomas.waldinger
- Member
- 10 posts
- Joined: July 2005
- Offline
- metaclay
- Member
- 122 posts
- Joined: May 2006
- Offline
thanx,
that's what i'm looking for ( ${…} )
why do i need the enumerated global var?…
i attached the hip file to be evaluated.
well, here's the case :
i want the to modify the grid color (point level) based on the particle position which is born on top of the grid surface. i'm using expression in point SOP. The expression itself is comparing each point of the grid with each particle. so inside the exp. i use a loop to cycle throgh all particle available at current time then compared to grid points.
with this expression, i can get the effect i want.
the problem : each point has to be compared with each particle. this calculation will take quite long when i use a big number of particle. as i play the simulation, more and more particle will be feed into the loop process.
i'm trying to make the calculation more ‘efficent’ (hopefully) :
how about if in each frame the loop only need to calculate the particle that's just born at just current frame only (It means the previous particle won't be counted) .so then This value then has to be added to previous color information (the previous calculation that count previous particle state.),
so to remember the prev state of color information, i think i have to save them somewhere globally, so the value won't be lost. well, that's why i need enumerated global var… so i can include it inside my loop by using index (i) -> global1 , global2 , global3 (coz array is not applicable here)
this will save the previous per point color information of the grid, so in next execution, i can load this global into local var , incremented by a constant value, then put back to global variable again.
am i making everything worse?
in my previous posting (with different topic :local var-> array).
as suggested by Wolfwood (for that kind of topic) to use channel and geometry CHOP, i'm trying to involve these operators to solve my problem and i'm still working on it ….
if there's any suggestion, pls …
thanx.
that's what i'm looking for ( ${…} )
why do i need the enumerated global var?…
i attached the hip file to be evaluated.
well, here's the case :
i want the to modify the grid color (point level) based on the particle position which is born on top of the grid surface. i'm using expression in point SOP. The expression itself is comparing each point of the grid with each particle. so inside the exp. i use a loop to cycle throgh all particle available at current time then compared to grid points.
with this expression, i can get the effect i want.
the problem : each point has to be compared with each particle. this calculation will take quite long when i use a big number of particle. as i play the simulation, more and more particle will be feed into the loop process.
i'm trying to make the calculation more ‘efficent’ (hopefully) :
how about if in each frame the loop only need to calculate the particle that's just born at just current frame only (It means the previous particle won't be counted) .so then This value then has to be added to previous color information (the previous calculation that count previous particle state.),
so to remember the prev state of color information, i think i have to save them somewhere globally, so the value won't be lost. well, that's why i need enumerated global var… so i can include it inside my loop by using index (i) -> global1 , global2 , global3 (coz array is not applicable here)
this will save the previous per point color information of the grid, so in next execution, i can load this global into local var , incremented by a constant value, then put back to global variable again.
am i making everything worse?
in my previous posting (with different topic :local var-> array).
as suggested by Wolfwood (for that kind of topic) to use channel and geometry CHOP, i'm trying to involve these operators to solve my problem and i'm still working on it ….
if there's any suggestion, pls …
thanx.
-
- Quick Links