c4d.bitmaps.MultipassBitmap

This is an extension of the BaseBitmap class that supports higher bit depths, even floating point images, and multiple layers.

The layers are stored hierarchically. There are three kinds of layers:

Layer A regular layer, with full range of functionality.
Folder A collection of layers. This is a dummy element that has no image content, but other stuff like name, visibility etc.
Alpha An alpha channel, with full range of functionality.

Inheritance

Members

static MultipassBitmap.AllocWrapper(bmp)

Allocates a multipass wrapper for bmp. The bitmap is internally copied because it must stay alive and not be freed unbtil after the allocated wrapper has been freed:

bmp = bitmaps.BaseBitmap()
bmp.InitWith("path_to_image")

mbp = bitmaps.MultipassBitmap.AllocWrapper(bmp)
# ...
Parameters:bmp (c4d.bitmaps.BaseBitmap) – Bitmap to wrap.
Return type:c4d.bitmaps.MultipassBitmap
Returns:The new multipass bitmap.
MultipassBitmap.__init__(bx, by, mode)

Allocates a multipass bitmap of size bx/by and bit depth given by mode. The first RGBA layer is also created.

Parameters:
  • bx (int) – Width in pixels.
  • bx – Height in pixels.
  • mode (int) –

    Main mode:

    COLORMODE_ILLEGAL Illegal 8-bit mode.
    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY 8-bit grayscale channel.
    COLORMODE_AGRAY 8-bit grayscale channel with 8-bit alpha.
    COLORMODE_RGB 8-bit RGB channels.
    COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
    COLORMODE_CMYK 8-bit CMYK channel.
    COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
    COLORMODE_MASK 8-bit grayscale map as mask.
    COLORMODE_AMASK 8-bit grayscale map as mask with 8-bit alpha.
    COLORMODE_ILLEGALw Illegal 16-bit mode.
    COLORMODE_GRAYw 16-bit grayscale channel.
    COLORMODE_AGRAYw 16-bit grayscale channel with 16-bit alpha.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
    COLORMODE_MASKw 16-bit grayscale map as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Illegal 32-bit mode.
    COLORMODE_GRAYf 32-bit floating point grayscale channel.
    COLORMODE_AGRAYf 32-bit floating point grayscale channel with floating point alpha.
    COLORMODE_RGBf 32-bit floating point RGB channels.
    COLORMODE_ARGBf 32-bit floating point RGB channels with floating point alpha.
    COLORMODE_MASKf 32-bit floating point grayscale map as mask.
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The new multipass bitmap.

MultipassBitmap.DeleteLayer(layer)

Deletes layer from the bitmap, freeing the memory.

Parameters:layer (c4d.bitmaps.MultipassBitmap) – The layer to delete. Never access this reference afterwards.
Return type:bool
Returns:True if successful, otherwise False.
MultipassBitmap.FindUserID(id, subid=0)

Finds a layer in the bitmap by ID.

Parameters:
  • id (int) – Main layer ID.
  • subid (int) – Sub ID.
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The found layer or None.

MultipassBitmap.ClearImageData()

Clears the image data for all layers. The layers themselves are not removed or deleted.

MultipassBitmap.GetPaintBitmap()

Gets a BodyPaint 3D paint bitmap for the multipass bitmap.

Return type:c4d.modules.bodypaint.PaintBitmap
Returns:The paint bitmap.
MultipassBitmap.FreeHiddenLayers()

Free the hidden layers.

MultipassBitmap.AddLayer(insertafter, colormode, hidden=False)

Adds a layer after insertafter with mode colormode after insertafter in the bitmap.

Parameters:
  • insertafter (c4d.bitmaps.MultipassBitmap) – The layer to insert after.
  • colormode (int) –

    Color mode of the new layer:

    COLORMODE_ILLEGAL Illegal 8-bit mode.
    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY 8-bit grayscale channel.
    COLORMODE_AGRAY 8-bit grayscale channel with 8-bit alpha.
    COLORMODE_RGB 8-bit RGB channels.
    COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
    COLORMODE_CMYK 8-bit CMYK channel.
    COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
    COLORMODE_MASK 8-bit grayscale map as mask.
    COLORMODE_AMASK 8-bit grayscale map as mask with 8-bit alpha.
    COLORMODE_ILLEGALw Illegal 16-bit mode.
    COLORMODE_GRAYw 16-bit grayscale channel.
    COLORMODE_AGRAYw 16-bit grayscale channel with 16-bit alpha.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
    COLORMODE_MASKw 16-bit grayscale map as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Illegal 32-bit mode.
    COLORMODE_GRAYf 32-bit floating point grayscale channel.
    COLORMODE_AGRAYf 32-bit floating point grayscale channel with floating point alpha.
    COLORMODE_RGBf 32-bit floating point RGB channels.
    COLORMODE_ARGBf 32-bit floating point RGB channels with floating point alpha.
    COLORMODE_MASKf 32-bit floating point grayscale map as mask.
  • hidden (bool) – If this is True, the layer is hidden.
MultipassBitmap.AddAlpha(insertafter, colormode)

Adds an alpha layer with mode colormode after insertafter in the bitmap.

Parameters:
  • insertafter (c4d.bitmaps.MultipassBitmap) – The layer to insert after.
  • colormode (int) –

    Color mode of the new alpha layer.

    COLORMODE_ILLEGAL Illegal 8-bit mode.
    COLORMODE_ALPHA Only 8-bit alpha channel.
    COLORMODE_GRAY 8-bit grayscale channel.
    COLORMODE_AGRAY 8-bit grayscale channel with 8-bit alpha.
    COLORMODE_RGB 8-bit RGB channels.
    COLORMODE_ARGB 8-bit RGB channels with 8-bit alpha.
    COLORMODE_CMYK 8-bit CMYK channel.
    COLORMODE_ACMYK 8-bit CMYK channel with 8-bit alpha.
    COLORMODE_MASK 8-bit grayscale map as mask.
    COLORMODE_AMASK 8-bit grayscale map as mask with 8-bit alpha.
    COLORMODE_ILLEGALw Illegal 16-bit mode.
    COLORMODE_GRAYw 16-bit grayscale channel.
    COLORMODE_AGRAYw 16-bit grayscale channel with 16-bit alpha.
    COLORMODE_RGBw 16-bit RGB channels.
    COLORMODE_ARGBw 16-bit RGB channels with 16-bit alpha.
    COLORMODE_MASKw 16-bit grayscale map as mask with 16-bit alpha.
    COLORMODE_ILLEGALf Illegal 32-bit mode.
    COLORMODE_GRAYf 32-bit floating point grayscale channel.
    COLORMODE_AGRAYf 32-bit floating point grayscale channel with floating point alpha.
    COLORMODE_RGBf 32-bit floating point RGB channels.
    COLORMODE_ARGBf 32-bit floating point RGB channels with floating point alpha.
    COLORMODE_MASKf 32-bit floating point grayscale map as mask.
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The added alpha layer or None

MultipassBitmap.AddFolder(insertafter, hidden=False)

Adds a folder after insertafter in the bitmap.

Parameters:
Return type:

c4d.bitmaps.MultipassBitmap

Returns:

The added folder or None.

MultipassBitmap.GetLayers(flags=MPB_GETLAYERS_IMAGE|MPB_GETLAYERS_ALPHA)

New in version R14.014.

Gets all the layers specified by flags.

Parameters:flags (int) –

Flags:

MPB_GETLAYERS_NONE None.
MPB_GETLAYERS_ALPHA Get alpha layers.
MPB_GETLAYERS_IMAGE Get image layers.
Return type:list[c4d.bitmaps.BaseBitmap]
Returns:The layers.
MultipassBitmap.GetParameter(id)

Gets a layer parameter.

Parameters:id (int) –

The layer parameter ID:

MPBTYPE_SHOW bool Determines if the layer will be shown in the external render window. (The Cinema 4D renderer modifies this value itself.)
MPBTYPE_SAVE bool Determines if the layer is saved with the image or not if SAVEBIT_USESELECTEDLAYERS is used.
MPBTYPE_PERCENT float The blend parameter, between 0.0 and 1.0.
MPBTYPE_BLENDMODE int The blend mode. (LAYER_NORMAL, LAYER_DISSOLVE etc. from from bplayer.h.)
MPBTYPE_COLORMODE int The color mode: See COLORMODE.
MPBTYPE_BITMAPTYPE int The bitmap type. Cannot be set with MultipassBitmap.SetParameter().
MPBTYPE_NAME str The layer name. Only a PaintLayerBmp or PaintLayerFolder can have a name.
MPBTYPE_DPI int The resolution in DPI. Private.
MPBTYPE_USERID int The user ID for the layer. In the renderer this is VPBUFFER_xxx.
MPBTYPE_USERSUBID int The user sub-ID for the layer. In the renderer this is used for blend channels for instance.
MPBTYPE_FORCEBLEND int The special mode used to force blend layers.
Return type:Any
Returns:The retrieved layer parameter data. Can be None.
MultipassBitmap.SetParameter(id, t_data)

Sets a layer parameter.

Parameters:
  • id (int) –

    The layer parameter ID:

    MPBTYPE_SHOW bool Determines if the layer will be shown in the external render window. (The Cinema 4D renderer modifies this value itself.)
    MPBTYPE_SAVE bool Determines if the layer is saved with the image or not if SAVEBIT_USESELECTEDLAYERS is used.
    MPBTYPE_PERCENT float The blend parameter, between 0.0 and 1.0.
    MPBTYPE_BLENDMODE int The blend mode. (LAYER_NORMAL, LAYER_DISSOLVE etc. from from bplayer.h.)
    MPBTYPE_COLORMODE int The color mode: See COLORMODE.
    MPBTYPE_BITMAPTYPE int The bitmap type. Cannot be set with MultipassBitmap.SetParameter().
    MPBTYPE_NAME str The layer name. Only a PaintLayerBmp or PaintLayerFolder can have a name.
    MPBTYPE_DPI int The resolution in DPI. Private.
    MPBTYPE_USERID int The user ID for the layer. In the renderer this is VPBUFFER_xxx.
    MPBTYPE_USERSUBID int The user sub-ID for the layer. In the renderer this is used for blend channels for instance.
    MPBTYPE_FORCEBLEND int The special mode used to force blend layers.
  • t_data (any) – The new parameter data.
Return type:

Any

Returns:

True if the layer parameter was successfully set, otherwise False.

MultipassBitmap.GetLayerNum(num)

Gets the layer with number num.

Parameters:num (int) – Layer index, 0 <= num < GetLayerCount().
Return type:c4d.bitmaps.MultipassBitmap
Returns:The retrieved layer, or None if the operation failed.
MultipassBitmap.GetAlphaLayerNum(num)

Gets the alpha layer with number num.

Parameters:num (int) – Alpha layer index, 0 <= num < GetAlphaLayerCount().
Return type:c4d.bitmaps.MultipassBitmap
Returns:The retrieved layer, or None if the operation failed.
MultipassBitmap.GetHiddenLayerNum(num)

Gets the hidden layer with number num.

Parameters:num (int) – Hidden layer index, 0 <= num < GetHiddenLayerCount().
Return type:c4d.bitmaps.MultipassBitmap
Returns:The retrieved layer, or None if the operation failed.
MultipassBitmap.GetLayerCount(num)

Retrieves the number of layers in the bitmap. This is the sum of the number of layers, folders and alphas that are direct children of this bitmap.

Parameters:num (int) – Hidden layer index, 0 <= num < GetHiddenLayerCount().
Return type:int
Returns:Layer count.
MultipassBitmap.GetAlphaLayerCount()

Retrieves the number of alpha layers in the bitmap.

Return type:int
Returns:Alpha layer count.
MultipassBitmap.GetHiddenLayerCount()

Retrieves the number of hidden layers in the bitmap.

Return type:int
Returns:Hidden layer count.