Melange:Unable to get shader preset texture path

On 16/02/2014 at 20:49, xxxxxxxx wrote:

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

Using Melange SDK, I am able to run through the list of shader's for each material and get the filename for shader type Xbitmap using the code as below:
BaseMaterial* mat = C4Ddoc->GetFirstMaterial();
BaseShader* shader=mat->GetFirstShader();
while (shader)
if (shader->GetType() == Xbitmap)
Filename filename = shader->GetFileName();
shader = shader->GetNext();
mat = mat->GetNext();

The above code only works with textures with absolute or relative path such as blah.png or //folder/blah.png.

If you have a preset texture path such as "preset://blah.lib4d/folder/blah.png", the above code does not work.

Appreciate if anyone could help or provide pointers on solving this problem.

On 17/02/2014 at 01:27, xxxxxxxx wrote:

Which version of Melange did you use?
I've just checked with the latest 6.0 #86243 and it works. (BaseShader::GetFileName() returns a texture name with "preset://..." at the start)

On 17/02/2014 at 01:38, xxxxxxxx wrote:

Good catch, I am using Melange 5.1 #71785. Let me get latest version and check the same.


Thanks a ton!

On 17/02/2014 at 08:35, xxxxxxxx wrote:

I tried using the latest version of Melange 6.0 #86243 but still have the same problem. I am not sure what I am missing here. The code logic remains the same.

Appreciate your help!

On 17/02/2014 at 08:51, xxxxxxxx wrote:

Which preset did you use? Is it included in a Cinema4D package and in what version?

On 17/02/2014 at 09:04, xxxxxxxx wrote:

The following are the preset which are used our clients c4d file:

I have looked up the information using R15 Texture Manager

On 18/02/2014 at 19:57, xxxxxxxx wrote:

I had tested with multiple preset files and confirm that the latest version of Melange is able to get textures with preset path.

That said, for one file(the file where we originally found the issue), Melange does not detect preset textures. I also did an additional test to "Save project with assets", now the file paths have absolute paths but still the one which were preset paths does not get detected. To summarize, it doesn't seem to be a problem with Melange but for the file itself. This is a weird issue and still trying to find out why this happens for only this file.

On 19/02/2014 at 00:36, xxxxxxxx wrote:

Thank you for checking this and sharing the information!
I'll have a look at this file too.

One more question, are you on OSX?

On 20/02/2014 at 17:53, xxxxxxxx wrote:

I am building Melange on Windows but use it in OSX/Linux using Wine.

On 26/02/2014 at 10:43, xxxxxxxx wrote:

I have zeroed in on the problem of some presets not detected on some c4d files. The code provided in the first post only handles default shaders (1st level) and shaders with textures can be deeply nested level hence had to do a recursive logic to go deeper by using BaseShader::getDown().

This should help someone using Melange to parse textures.

On 26/02/2014 at 12:12, xxxxxxxx wrote:

Ah ok, so you weren't at the correct shader. Yes, the shader hierarchy can get very complex :)
Thanks for letting us know.