GetAlphaGradient

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/07/2005 at 18:18, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.503 
Platform:      
Language(s) :     C++  ;

---------
I've been trying to figure out how to initialize a gradient's alpha without much luck.

I have a gradient in my description with COLOR; and ALPHA; specified.
In my plugin's Init I allocate a gradient with AutoAlloc, insert a few knots, and initialize the control with it.
Works absolutely fine. Pretty standard stuff I think, but if you'd like me to post the code anyway, I would be glad to.

The SDK docs (both 8.5 and 9.1) are pretty vague.
The description for GetAlphaGradient reads: "Alpha gradient. The gradient owns the pointed knot.".

Anyway, I can't seem insert any knots in the gradient's alpha, let alone get a pointer to the alpha gradient.

Anyone have any success with this?

-Chris

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/07/2005 at 20:34, xxxxxxxx wrote:

No one?

I'll keep trying and let you know if I figure it out.

-Chris

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2005 at 06:40, xxxxxxxx wrote:

Hmm, it seems the documentation is missing the step in red:

    
    
    AutoAlloc<Gradient> g;  
    g->SetData(GRADIENT_MODE, GeData(GRADIENTMODE_COLORALPHA));
    
    
    
    
    GradientKnot k1;  
    k1.pos = 0;  
    k1.index = 0;  
    k1.brightness = 1.0;  
    k1.bias = 0.5;  
    k1.col = Vector(1,0,0);
    
    
    
    
    GradientKnot k2;  
    k2.pos = 1;  
    k2.index = 1;  
    k2.brightness = 0.5;  
    k2.bias = 0.8;  
    k2.col = Vector(0.5,0.5,0);
    
    
    
    
    g->InsertKnot(k1);  
    g->InsertKnot(k2);
    
    
    
    
    Gradient* ag = g->GetAlphaGradient();  
    if (ag)  
    {  
        ag->InsertKnot(k1);  
        ag->InsertKnot(k2);  
    }
    
    
    
    
    GeData d(CUSTOMDATATYPE_GRADIENT, g);  
    data->SetData(TESTGRAD, d);

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2005 at 06:53, xxxxxxxx wrote:

Thanks Mikael. I will try that out soon.

-Chris