Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Evaluation of Gradient in Message...

    SDK Help
    0
    3
    350
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post