Preset bitmaps
-
On 25/01/2017 at 07:30, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R18
Platform: Windows ;
Language(s) : C++ ;---------
Hello.I have a lib4d file, which contains some bitmaps (png).
Whenever I assign any of these in a shader parameter I get a value like preset://MyLib.lib4d/my_texture.png.How can I use this texture in my render engine, which requires full path in bitmaps ?
Is there any example ?Thank you for your time.
-
On 25/01/2017 at 07:54, xxxxxxxx wrote:
You can simply load it as a BaseBitmap.
Check before if preset exist with ExistsPreset then just create new BaseBitmap and instead of loading a file with his path fill this path with the preset path.If you still need to have a real path you could make a basebitmap from the preset as desribed above and then save it in his own format you got an exemple here in python but you should be able to convert it into C++ without problem https://gist.github.com/NiklasRosenstein/fa9c9f72fa819dc001e4
Hope it's help you
-
On 26/01/2017 at 04:04, xxxxxxxx wrote:
Hello and thank you very much for your answer.
I have tried what you wrote. Nevertheless, in the following 2 files, the first one returns false, while the second one returns true. (preset_file is Filename)
bool preset_filename_exists = SDKBrowser::ExistsPreset( preset_file ); bool preset_string_exists = SDKBrowser::ExistsPreset( preset_file .GetString() );
I couldn't find why...
Other than that, using BaseBitmap::Init to load it as bitmap and saving it afterwards works correctly !
The code in the link is very useful.What I would like to know though is how to save the file in the exact same format and settings as when you read it. Are Filter and Savebit enumarations enough to do that ? ( parameters in BaseBitmap's Save method ).
Thank you very much.
-
On 27/01/2017 at 07:32, xxxxxxxx wrote:
Hi,
I can reproduce the behavior here. There seems to be going something wrong with the SDKBrowserURL constructor from Filename.
I'm lacking the time to look into it today. Will do next week. -
On 27/01/2017 at 17:29, xxxxxxxx wrote:
Originally posted by xxxxxxxx
What I would like to know though is how to save the file in the exact same format and settings as when you read it. Are Filter and Savebit enumarations enough to do that ? ( parameters in BaseBitmap's Save method ).
Had this problem a while ago, only solution I found is this (GitHub Gist).
Cheers,
NiklasEdit : Ups I just saw that gr4ph0s already linked the Gist above. Man's way quicker than I am
I also missed the parameters part that you want to maintain when exporting the image, which that
method doesn't solve.Sounds like a job for LoadPreset() maybe?