On 17/08/2014 at 13:25, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
This is probably a long shot.
But does anyone know how (or if it's possible) to put image layers inside of custom folders we add ourselves?
I've spent the day learning how to create custom image layers and set up the various options for them. But I can't figure out how to put the layers inside the folders I add.
//This code copies a bitmap source image and creates a new one using a MultipassBitmap()
//Then it adds a new layer to it and sets the various layer options
Bool SimplePlugin::Execute(BaseDocument *doc)
{
//The path to the image we want to copy
Filename fn = GeGetC4DPath(C4D_PATH_DESKTOP) + "sourceImage.jpg";
if(!GeFExist(fn, FALSE)) return FALSE;
//Put the image into a newBaseBitmap object
AutoAlloc<BaseBitmap> sourceImage;
sourceImage->Init(fn);
//Create a new MultipassBitmap using the sourceImage BaseBitmap's data
AutoFree<MultipassBitmap> clonedImg = MultipassBitmap::AllocWrapper(sourceImage);
clonedImg->Init(fn);
clonedImg->AddFolder(NULL, FALSE); //<---How do I put the new layer below insde of this new folder?
//Save the multilayer image with a new alpha layer so that we can draw on top of the orignal image without destroying it
clonedImg->AddLayer(NULL, COLORMODE_ARGBf, FALSE);
//Retrieve a specific layer
LONG layercount = clonedImg->GetLayerCount();
//GePrint(LongToString(layercount));
//ID#s are from ..\..\..\..\resource\res\description\bplayer.h
MultipassBitmap *layer = clonedImg->GetLayerNum(0); if(!layer) return FALSE;
layer->SetParameter(MPBTYPE_NAME, "My First New Layer");
layer->SetParameter(MPBTYPE_BLENDMODE, LAYER_MULTIPLY); //Sets the blend mode
layer->SetParameter(MPBTYPE_PERCENT, 0.5); //Sets the layer's opacity value
layer->SetParameter(MPBTYPE_USERID, 123456); //Assigns a userID to the layer
layer->SetParameter(MPBTYPE_SAVE, TRUE); //Saves the layer
LONG colmode = layer->GetParameter(MPBTYPE_COLORMODE).GetLong();
GePrint(LongToString(colmode));
LONG DPI = layer->GetParameter(MPBTYPE_DPI).GetLong();
GePrint(LongToString(DPI));
clonedImg->Save(GeGetC4DPath(C4D_PATH_DESKTOP) + Filename("testImg.tif"), FILTER_TIF, 0, SAVEBIT_MULTILAYER);
EventAdd();
return TRUE;
}
-ScottA