Sample & Absolute Paths?

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

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;

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