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

    Sample & Absolute Paths?

    SDK Help
    0
    3
    445
    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 08/07/2005 at 09:07, xxxxxxxx wrote:

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

      ---------
      Hello all, here is my problem:

      I am sampling the channel of a material. It's working perfectly except when the channel has an image file specified (with a relative path) and that image file is in the document path.

      So for example, if I have an scene here: "c: est\untitled 1.c4d" and an image here: "c: est\image1.jpg", if I load "image1.jpg" into the color channel of a material with a relative path "image1.jpg" it will not work.
      If I manualy specify an absolute path "c: est\image1.jpg" it works fine.

      Here's my code:

        
      InitRenderStruct irs;  
      irs.version = GetC4DVersion();  
      irs.fps = cdoc->GetFps();  
      irs.time = cdoc->GetTime();  
      irs.doc = cdoc;  
      irs.docpath = const_cast<Filename*>(&cdoc-;>GetDocumentPath());  
      irs.flags = INITRENDERFLAG_TEXTURES;  
        
      if (basechan->InitTexture(&irs;) == LOAD_OK) {  
        
           ...  
        
           sample = basechan->Sample(NULL, &uvw;, &dlt;, &nn;, sec, 0, 0.0, 0.0);  
      }  
      

      InitTexture is returning LOAD_OK

      Any ideas?

      -Chris

      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 10/07/2005 at 01:37, xxxxxxxx wrote:

        I'm surprised the compiler doesn't complain about "irs.docpath = const_cast<Filename*>(&cdoc->GetDocumentPath());", since it looks very dubious to me. You're getting the address to a temporary Filename object, which will be destructed before the next line, if I get the language rules right.
        Try changing this line to:

            
            
            Filename docpath = cdoc->GetDocumentPath();  
            irs.docpath = &docpath;
        
        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 10/07/2005 at 04:41, xxxxxxxx wrote:

          Thanks Mikael, that worked great. And VC6 did not complain about it one bit.

          > Quote: __
          >
          > * * *
          >
          > I'm surprised the compiler doesn't complain about "irs.docpath = const_cast<Filename*>(&cdoc-;>GetDocumentPath());", since it looks very dubious to me.
          >
          >
          >
          >
          > * * *

          I actually got that straight from one of your posts. 😃
          Examples of GetBitmap

          Thanks again,

          -Chris

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