Copy Content Browser Items



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/11/2012 at 08:41, xxxxxxxx wrote:

    I'm really trying to be able to use a Content Browser Path 'preset://anylib.c4d/anything/anything.ext'
    and copy it (the file) to a selected folder on disc. The file being "anything" , bitmap or objects.
    Any kind hints?

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/11/2012 at 14:19, xxxxxxxx wrote:

    If we look at bitmaps only to start with, not caring about objects
    in Content Browser….

    Is it something simple I've must be missing or is it as
    complicated as I suspect it might be?

    Right now I manage to copy a HDR from CB to where I want it
    using the "Copy32BitmapExample" in the SDK.
    (On my way to manage 24bit files tomorrow)
    If I get it correct, I need to check each and every parameter
    in the source bitmap (size, bitdepth,format etc) and -rebuild- the bitmap?
    And according to the SDK still can't manage Alpha's.

    Maxon, you put the picts in there, let's hear how we can get them out
    to where we want them in a 1 to 1 (copy) way :) !

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/11/2012 at 18:57, xxxxxxxx wrote:

    Half way there but on a side track :)
    To see if I could get anything to work I managed to interpret
    C++ code by Tobias Pfob from a closed forum, to COFFEE.
    It does indeed make a 1 to 1 copy from "real" files in Content Browser.
    That is, images and i.e. .c4d files but not "compressed" objects like
    objects dragged into the CB from OM, not a big problem atm.

    Trying to manage this in Python, I can't seem to find a "BaseFile" to
    use. Something to initialize with a filename (the Content Browser Path "preset:// mylib.lib4d/etc..)
    as I can't find a way for Python the accept a "non mounted" path, such as the CB path.

    Are we looking at using HyperFile? No experience at all with that yet.

    Any idea and,
    my question now would be if this is possible with Python at all?
    (Would be nice to not only talk to myself here :) )

    Cheers
    Lennart

      
    main(doc,op)   
    {   
    var scr = new(Filename);   
         scr->SetFullString("preset://Prime.lib4d/Materials/HDRI/tex/HDR011.hdr");   
      
    var dst = new(Filename);   
         dst->SetFullString("/Users/lennart/Desktop/AAA.hdr");   
      
    var fsrc = new(BaseFile);   
    var fdst = new(BaseFile);   
      
    if(fsrc->Open(scr, FILEOPEN_READ))   
         {   
              println ("SOURCE OPEN");   
              if(fdst->Open(dst, FILEOPEN_WRITE))   
                   {   
                        println ("DEST OPEN");   
                        var bitsize = fsrc->GetLength();   
                        println (bitsize);   
                        var c     = new(bytes,bitsize);   
                        fsrc->ReadBytes(c,bitsize);   
                        fdst->WriteBytes(c,bitsize);   
                        fdst->Close();   
                        println ("DEST CLOSED");   
                   }   
              fsrc->Close();   
              println ("SOURCE CLOSED");   
         }   
    gc();   
    }   
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 00:46, xxxxxxxx wrote:

    If a preset is of the type "File Preset", then it should be possible to just use SDKBrowser::LoadPreset() and write the data that is returned via void** data to a .c4d file on hard disk.

    If it's a specific preset format like "Object Preset" or "Material Preset" you will have to load it into a (dummy) document and then simply store the document.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 00:47, xxxxxxxx wrote:

    Oh wait, I just notice you're speaking of COFFEE. Then sorry, I have no idea ;-)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 08:08, xxxxxxxx wrote:

    I would first try to find out from Maxon if this is even supported in Python. Before trying too hard to write the code.
    I could not find any of the SDKBrowser stuff that's in the C++ docs in the Python docs.
    AFAIK. It doesn't look like any of Content Browser stuff has been ported to Python yet.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 08:18, xxxxxxxx wrote:

    Frank, thanks for your input. The COFFEE here was just an example (from a C++ example).
    I'm looking for a way to manage this with Python.
    Cinema Python -does- access the presets initialising a BaseBitmap object as seen in the
    "Copy32BitImageExample" from the SDK. But that way is very error prone as it doesn't
    make a 1 to 1 copy in a safe way.

    The C++ / COFFEE examples do make a "carbon copy" as they copy bit by bit.

    @Scott, that is what I really trying, to get an answer for from Maxon here at the official forum :)

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 09:36, xxxxxxxx wrote:

    Right now I manage to copy a HDR from CB to where I want it using the "Copy32BitmapExample" in the SDK.

    How have you been able to access the presets in the content browser?

    Originally posted by xxxxxxxx

    Cinema Python -does- access the presets initialising a BaseBitmap object as seen in the
    "Copy32BitImageExample" from the SDK. But that way is very error prone as it doesn't
    make a 1 to 1 copy in a safe way.

    I don't understand this, how do you know that Python module in CINEMA access the presets?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 10:39, xxxxxxxx wrote:

    Hi Yannick. I simply used a existing CB path ( like "preset://prime.lib4d/Materials/HDRI/tex/HDR018.hdr")
    in the Copy32BitImageExample as source to init the bitmap.BaseBitmap() and set a save path to desktop.

    The issue with this method, as mentioned, is that one needs to examine every aspect of the source like
    channel count, type of alpha, colour profile bit depth for other types of images etc etc.
    That is the part that makes it hard to do a 1 to 1 copy.

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 15:31, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Hi Yannick. I simply used a existing CB path ( like "preset://prime.lib4d/Materials/HDRI/tex/HDR018.hdr")
    in the Copy32BitImageExample as source to init the bitmap.BaseBitmap() and set a save path to desktop.

    Ok I see, BaseMaterial.InitWith() supports presets' URL strings.

    Originally posted by xxxxxxxx

    The issue with this method, as mentioned, is that one needs to examine every aspect of the source like
    channel count, type of alpha, colour profile bit depth for other types of images etc etc.
    That is the part that makes it hard to do a 1 to 1 copy.

    I think it shouldn't be too hard to do a 1 to 1 copy of bitmaps with BaseBitmap.InitWith() and BaseBitmap.Save() methods, like this with HDR files:

    src = bitmaps.BaseBitmap()
    path = "preset://prime.lib4d/Materials/HDRI/tex/HDR018.hdr"
    if src.InitWith(path)[0]==c4d.IMAGERESULT_OK:
        src.Save("path/to/dest/HDR018.hdr", c4d.FILTER_HDR)
    

    Unfortunately, without BaseFile class in Python there's no easy and quick way to copy any kind of file.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 16:03, xxxxxxxx wrote:

    Hi Yannick, I'm very thankful for your input.
    To the best of my knowledge, BaseBitmap defaults to 8bit (I'll check that again)
    hence the 32bit example in the SDK. As far as I can tell, one needs to set all data
    (by extracting it from the source) for the newly created bitmap.
    Soon back to see if your idea works.

    Thanks
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/11/2012 at 16:22, xxxxxxxx wrote:

    You know what, Yannick? It looks promising!
    Didn't come to my mind to save it "direct" from source bitmap
    rather l was "locked" to the SDK example.

    I'll make some more in-depth tests tomorrow.

    Again Thanks
    Lennart


Log in to reply