c4d.BaseMaterial

class c4d.BaseMaterial

This is the material base class that all materials in Cinema 4D are derived from.

Methods Signatures

BaseMaterial.__init__(self, type)

Initialize a new BaseMaterial in memory.

BaseMaterial.Compare(self, snd)

Check if the materials are identical.

BaseMaterial.GetPreview(self[, flags])

Retrieves the preview picture of the material.

BaseMaterial.GetAverageColor(self[, channel])

Returns an average color for the material, based on the material preview.

BaseMaterial.Update(self, preview, rttm)

Recalculates the material’s thumbnail and updates internal values.

BaseMaterial.GetRenderInfo(self)

Retrieves information about what the material requires from the raytracer and what it will return.

BaseMaterial.GetNodeMaterialReference(self)

Returns a weak reference of the actual Material as a c4d.NodeMaterial.

Inheritance

Parent Class:

Children Classes:

Methods Documentation

BaseMaterial.__init__(self, type)

Initialize a new BaseMaterial in memory.

Parameters

type (int) – The material type : Material Types.

Return type

c4d.BaseMaterial

Returns

The new material.

BaseMaterial.Compare(self, snd)

Check if the materials are identical.

Note

Only the name of the compared materials can be different.

Parameters

snd (c4d.BaseMaterial) – The material to compare with.

Return type

bool

Returns

True if the materials contents are the same, otherwise False.

BaseMaterial.GetPreview(self, flags=0)

Retrieves the preview picture of the material.

Parameters

flags (int) – Currently not used.

Return type

c4d.bitmaps.BaseBitmap

Returns

The preview picture or None if it has not been calculated.

BaseMaterial.GetAverageColor(self, channel=NOTOK)

Returns an average color for the material, based on the material preview.

Parameters

channel (int) –

An optional specific channel to get the average for.

CHANNEL_COLOR

The color channel of a material.

CHANNEL_LUMINANCE

The luminance channel of a material.

CHANNEL_TRANSPARENCY

The transparency channel of a material.

CHANNEL_REFLECTION

The reflection channel of a material.

CHANNEL_ENVIRONMENT

The environment channel of a material.

CHANNEL_FOG

The fog channel of a material.

CHANNEL_BUMP

The bump channel of a material.

CHANNEL_ALPHA

The alpha channel of a material.

CHANNEL_SPECULAR

The specular channel of a material.

CHANNEL_SPECULARCOLOR

The specular color channel of a material.

CHANNEL_GLOW

The glow channel of a material.

CHANNEL_DISPLACEMENT

The displacement channel of a material.

CHANNEL_DIFFUSION

The diffusion channel of a material.

CHANNEL_NORMAL

The normal channel of a material.

CHANNEL_ANY

An unlabeled plugin channel.

Return type

c4d.Vector

Returns

Average color.

BaseMaterial.Update(self, preview, rttm)

Recalculates the material’s thumbnail and updates internal values.

Note

Recalculating the thumbnail/RTTM image is time intensive.
It only needs to be done if you want to let the user view the change.
The calculations are done asynchronously.
Parameters
  • preview (bool) – If this value is True then the preview thumbnail is updated.

  • rttm (bool) – If this value is True then the real time texture map of the material will be recalculated.

BaseMaterial.GetRenderInfo(self)

Retrieves information about what the material requires from the raytracer and what it will return.

Return type

int

Returns

The return values are:

VOLUMEINFO_NONE

None.

VOLUMEINFO_REFLECTION

Calculates reflections.

VOLUMEINFO_TRANSPARENCY

Calculates transparency.

VOLUMEINFO_ALPHA

Calculates alpha.

VOLUMEINFO_CHANGENORMAL

Calculates bump mapping.

VOLUMEINFO_DISPLACEMENT

Calculates displacement mapping.

VOLUMEINFO_ENVREQUIRED

Needs environment reflection data.

VOLUMEINFO_DUDVREQUIRED

Needs du/dv bump mapping data.

VOLUMEINFO_MIPSAT

Requires MIP/SAT data.

VOLUMEINFO_VOLUMETRIC

Is volumetric.

VOLUMEINFO_TRANSFORM

Needs back-transformed data.

VOLUMEINFO_EVALUATEPROJECTION

Requires texture tag projections.

VOLUMEINFO_PRIVATE_GLOW

Calculates glow. Private.

VOLUMEINFO_INITCALCULATION

Needs InitCalculation() call.

VOLUMEINFO_FINAL_ALPHA

New in version R18: Writes final alpha value.

BaseMaterial.GetNodeMaterialReference(self)

Returns a weak reference of the actual Material as a c4d.NodeMaterial.

Returns

The material as a c4d.NodeMaterial.

Return type

c4d.NodeMaterial