Evaluation of Gradient in Message...



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

    On 07/09/2003 at 12:45, xxxxxxxx wrote:

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

    ---------
    I have a channel shader and I want to use the Gradient Customgui but whenever I try to use it it crashes. :\
    I am allocating it in my Init() function. Then initialize the renderer in InitRender and free it in FreeRender. That works fine in my output function.
    But if I try to CalcGradientPixel in my message function it crashes. I tried allocating a second instance in the message function but that doesn´t work either somehow.
    Is it possible?
    Thanks in advance
    Samir



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

    On 08/09/2003 at 02:06, xxxxxxxx wrote:

    I cannot confirm this. If you allocate an independent second instance in the Message() function and it crashes then it would crash everywhere. (Otherwise something is really broken.) But this code didn't crash in a menu plugin:

        
        
          AutoAlloc<Gradient> grad;
        
        
        
        
          grad->InitRender();  
          grad->CalcGradientPixel(0.0); // No knots  
          grad->FreeRender();
        
        
        
        
          GradientKnot knot;  
          grad->InsertKnot(knot);  
          knot.col = 0.0;  
          knot.pos = 1.0;  
          grad->InsertKnot(knot);
        
        
        
        
          grad->InitRender();  
          grad->CalcGradientPixel(0.5); // Two knots  
          grad->FreeRender();
        
        
        
        
          return TRUE;
    

    So what does your gradient allocation look like?



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

    On 08/09/2003 at 04:23, xxxxxxxx wrote:

    hi,
    thx first. I found the problem. If I would have done it like you did that would have worked but I needed the values of the first gradient instance and everytime I accessed it, it crashed.
    my pointer to the first gradient was set to NULL in FreeRender(). So now it works just fine:)
    Thank you


Log in to reply