Open Search
    RendererDefaultMaterialInterface Class Reference

    #include <createdefaultmaterialdelegate.h>

    Detailed Description

    Helper class to get/set the default material for renderers.

    Static Public Member Functions

    static MAXON_METHOD void SetRendererDefaultMaterial (Int32 rendererId, Int32 materialId)
     
    static MAXON_METHOD Int32 GetRendererDefaultMaterial (Int32 rendererId)
     

    Private Member Functions

     MAXON_INTERFACE_NONVIRTUAL (RendererDefaultMaterialInterface, MAXON_REFERENCE_STATIC, "net.maxon.rendererdefaultmaterial.interface")
     

    Member Function Documentation

    ◆ MAXON_INTERFACE_NONVIRTUAL()

    MAXON_INTERFACE_NONVIRTUAL ( RendererDefaultMaterialInterface  ,
    MAXON_REFERENCE_STATIC  ,
    "net.maxon.rendererdefaultmaterial.interface"   
    )
    private

    ◆ SetRendererDefaultMaterial()

    static MAXON_METHOD void SetRendererDefaultMaterial ( Int32  rendererId,
    Int32  materialId 
    )
    static

    Allows to define the default material (materialId) based on the current active renderer (rendererId) that is created when Cinema 4D preferences / Material / Material Manager / Default Material dropdown is set to "Auto".

    See also
    WPREF_MATMANAGER_DEFAULT_MATERIAL_AUTO
    GetRendererDefaultMaterial If is undefined for the current active renderer, then a standard Cinema 4D material will be created instead. Example of use:
    #include "maxon/materialdelegate.h"
    Bool RegisterPyshicalRender()
    {
    // When "Physical Renderer" is active, the default material created will be "PBR".
    maxon::SetRendererDefaultMaterial(PYSICAL_RENDERER_ID, PBR_MATERIAL_ID);
    return RegisterVideoPostPlugin(PYSICAL_RENDERER_ID, GeLoadString(IDS_PHYSICAL_RENDERER), PLUGINFLAG_VIDEOPOST_ISRENDERER, PhysicalRender::Alloc, "Physical render"_s, 0, VPPRIORITY_EXTERNAL);
    }
    const String & GeLoadString(Int32 id)
    Bool RegisterVideoPostPlugin(Int32 id, const maxon::String &str, Int32 info, DataAllocator *g, const maxon::String &description, Int32 disklevel, Int32 priority)
    maxon::Bool Bool
    Definition: ge_sys_math.h:55
    #define PLUGINFLAG_VIDEOPOST_ISRENDERER
    Renderer.
    Definition: c4d_videopostdata.h:284
    #define VPPRIORITY_EXTERNAL
    Priority for remote (external).
    Definition: c4d_videopostdata.h:275
    Parameters
    [in]rendererIdThe renderer ID.
    [in]materialIdThe material ID.

    ◆ GetRendererDefaultMaterial()

    static MAXON_METHOD Int32 GetRendererDefaultMaterial ( Int32  rendererId)
    static

    Gets the material ID that has been defined for the renderer ID.

    See also
    SetRendererDefaultMaterial
    Parameters
    [in]rendererIdThe renderer ID to query the material ID from.
    Returns
    The material ID.