Only Able to pull values from one channel ramp

   1294   2   0
User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
Hello,

I have 3 channel ramps that I am trying to get values from with a vex function.

Using the same code for each ramp however only lets me get values from one ramp.

If someone can spot what I may be obviously overlooking, it's appreciated.

The original problem is from a project where the function is in an external file and referenced with an include statement.

In the file I am attaching, it is a stripped down version of that function and defined/declared directly in the wrangle of the hip file.

I've double checked the names of the ramps and looked to see in the Parameter Edit Interface if there was some setting different between the different ramps.

Other than playing around with the sliders to input different values( which consequently give no results) I don't see anything different between all three ramps.

The only ramp I can get values from is the one named “red”.

Here's the code ( maybe it's obvious with the code and the file doesn't need looking at ):

//************************

// Function Declare/Define

//************************

function void Color_Ramp_Channels( int Number_Of_Points; string Imported_Red, Imported_Green, Imported_Blue)
{
int Count;

float F_Red, F_Green, F_Blue;
vector V_Color;

for(Count = 0; Count < Number_Of_Points; Count++)
{


F_Red = efit(float(Count), 0.0, Number_Of_Points, 0.0, 1.0);
F_Red = chramp( Imported_Red, F_Red) ;

F_Green = efit(float(Count), 0.0, Number_Of_Points, 0.0, 1.0);
F_Green = chramp( Imported_Green, F_Green) ;


F_Blue = efit(float(Count), 0.0, Number_Of_Points, 0.0, 1.0);
F_Blue = chramp( Imported_Blue, F_Blue) ;


V_Color = set(F_Red, F_Green, F_Blue);

setpointattrib(geoself(), "Cd", Count, V_Color, "set");

}

}

//************************ Code Start ***************************


int Total_Points;
Total_Points = npoints(geoself());

Color_Ramp_Channels(Total_Points, "red", "green", "blue");


Thanks
Edited by BabaJ - March 31, 2017 17:27:33

Attachments:
Get all Color Ramps.hiplc (63.5 KB)

User Avatar
Member
2566 posts
Joined: June 2008
Offline
I think it is because your ramp parameters are Colors and not Floats. when I changed all three ramps to float ramp types, the code started to work.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
Hmmm..I'm ok with using floats…but I wonder why only one of the color ramps work, but not the other 2.


Edit: Ok…I know why…I should have been returning it to a vector. I was returning it to a float.
As soon as I tried pluggin in a vector to take the return, I started getting results.

Thanks, Enivob…made me look at it a bit different..then looked at docs again…then got the idea to try it, which I didn't think of before.
Edited by BabaJ - March 31, 2017 21:22:46
  • Quick Links