GlobalUtilsInterface Class Reference

#include <globalimport.h>

Detailed Description

GlobalUtils provides some helper functionality to react to global import settings.

Static Public Member Functions

static MAXON_METHOD Result< void > ConvertObjects (BaseArray< cinema::BaseObject * > &objList, const Delegate< Result< void >(cinema::BaseObject *, cinema::BaseObject *)> &customOperation=nullptr)
 
static MAXON_METHOD Result< cinema::BaseMaterial * > CreateGenericMaterial (const material::MaterialExchangeData &materialData, Id nodeSpace, cinema::BaseDocument &baseDocument)
 
static MAXON_METHOD Result< void > ConvertTextureTosRGB (ImageTextureRef &textureRef)
 
static MAXON_METHOD Color ComputeColorTemperatureRGB (Float fTemperature, Bool bNormalize, Float fReference=6500)
 
static MAXON_METHOD Result< FloatRSLightGetBaseIntensity (cinema::BaseObject *object)
 
static MAXON_METHOD Result< void > RSLightConvertToUnit (cinema::BaseObject *object, Int32 targetUnitId)
 
static MAXON_METHOD Color GetRandomColor (Int32 seed)
 
static MAXON_METHOD Result< void > InitializeGlobalColorConversionHandler (const cinema::BaseDocument *doc=nullptr)
 
static MAXON_METHOD void ClearGlobalColorConversionHandler ()
 
static MAXON_METHOD void ConvertColorWithGlobalHandler (Vector &color, Bool low=true)
 
static MAXON_METHOD void ConvertColorWithGlobalHandler (Vector32 &color, Bool low=true)
 
static MAXON_METHOD Result< void > ConvertSceneToExportSpace (cinema::BaseDocument *doc)
 
static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear (cinema::BaseDocument *doc, Color &color, const LiteralId &direction)
 
static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear (cinema::BaseDocument *doc, Color32 &color, const LiteralId &direction)
 
static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear (cinema::BaseDocument *doc, ColorA &color, const LiteralId &direction)
 
static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear (cinema::BaseDocument *doc, ColorA32 &color, const LiteralId &direction)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (GlobalUtilsInterface, MAXON_REFERENCE_STATIC, "net.maxon.exchange.interface.globalutils")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( GlobalUtilsInterface  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.exchange.interface.globalutils"   
)
private

◆ ConvertObjects()

static MAXON_METHOD Result<void> ConvertObjects ( BaseArray< cinema::BaseObject * > &  objList,
const Delegate< Result< void >(cinema::BaseObject *, cinema::BaseObject *)> &  customOperation = nullptr 
)
static

Converts passed object to Redshift Objects.

Parameters
[in]objListThe list of objects to convert.
Returns
The converted list of objects.

◆ CreateGenericMaterial()

static MAXON_METHOD Result<cinema::BaseMaterial*> CreateGenericMaterial ( const material::MaterialExchangeData materialData,
Id  nodeSpace,
cinema::BaseDocument baseDocument 
)
static

Creates a generic material based on basic material data and node space.

Parameters
[in]materialDataThe properties of the material.
[in]nodeSpaceThe node space ID the material is created for.
[in]baseDocumentThe active document the import is happening. Note: The material will not be inserted into the document!
Returns
The pointer to the created material.

◆ ConvertTextureTosRGB()

static MAXON_METHOD Result<void> ConvertTextureTosRGB ( ImageTextureRef &  textureRef)
static

Convert an ImageTextureRef to an sRGB color profile.

Parameters
[in,out]textureRefThe texture to transform the color profile.
Returns
The error if any.

◆ ComputeColorTemperatureRGB()

static MAXON_METHOD Color ComputeColorTemperatureRGB ( Float  fTemperature,
Bool  bNormalize,
Float  fReference = 6500 
)
static

Convert a temperature value to a RGB color value.

Parameters
[in]fTemperatureThe temperature value to convert.
[in]fReferenceThe reference temperature usually 6500
[in]bNormalizeNormalize the color, so values are between 0 and 1.
Returns
The corresponding color value.

◆ RSLightGetBaseIntensity()

static MAXON_METHOD Result<Float> RSLightGetBaseIntensity ( cinema::BaseObject object)
static

Retrieve base intensity from the redshift light object. Base intensity is a raw (unnormalized, no scaling factor, in metric spatial system) intensity that is used for "Image" units in redshift lights.

Parameters
[in]objectredshift light object
Returns
base intensity calculated from the given redshift light object

◆ RSLightConvertToUnit()

static MAXON_METHOD Result<void> RSLightConvertToUnit ( cinema::BaseObject object,
Int32  targetUnitId 
)
static

Convert given redshift light intensity to the target units.

Parameters
[in,out]objectredshift light object to perform conversion on
[in]targetUnitIdid of the target light units (defined in orslight.h with prefix REDSHIFT_LIGHT_UNITSTYPE_)
Returns
The error if any

◆ GetRandomColor()

static MAXON_METHOD Color GetRandomColor ( Int32  seed)
static

Creates a random color with a random hue but consistent saturation and value (lightness).

Parameters
[in]seedSeed for random number generator
Returns
Random color

◆ InitializeGlobalColorConversionHandler()

static MAXON_METHOD Result<void> InitializeGlobalColorConversionHandler ( const cinema::BaseDocument doc = nullptr)
static

Initializes the global export color conversion handler that is used by ConvertColorWithGlobalHandler. The color conversion will be initialized to convert from current active document render color space to the chosen export color space. In case the source document is in legacy color management, the low source color space will be sRGB non linear and the high color space sRGB linear. Colors in the node editor use the high color space and need to pass low = false when ConvertColorWithGlobalHandler is called.

Parameters
[in]docOptional document to read the source settings from. Active document is taken otherwise.
Returns
OK on success

◆ ClearGlobalColorConversionHandler()

static MAXON_METHOD void ClearGlobalColorConversionHandler ( )
static

Clears the global color conversion handler.

◆ ConvertColorWithGlobalHandler() [1/2]

static MAXON_METHOD void ConvertColorWithGlobalHandler ( Vector color,
Bool  low = true 
)
static

Converts a color from document color space to export color space. InitializeGlobalColorConversionHandler needs to be called before using this.

Parameters
[in,out]colorA reference to the color to convert.
[in]lowIf true the low source color space will be used. The high color space otherwise.

◆ ConvertColorWithGlobalHandler() [2/2]

static MAXON_METHOD void ConvertColorWithGlobalHandler ( Vector32 color,
Bool  low = true 
)
static

Converts a color from document color space to export color space. InitializeGlobalColorConversionHandler needs to be called before using this.

Parameters
[in,out]colorA reference to the color to convert.
[in]lowIf true the low source color space will be used. The high color space otherwise.

◆ ConvertSceneToExportSpace()

static MAXON_METHOD Result<void> ConvertSceneToExportSpace ( cinema::BaseDocument doc)
static

Converts a scene to the export color space defined in the preferences. The scene is not allowed to be the active scene! only scene copies should be converted to export space.

Parameters
[in]docThe Document to convert.
Returns
OK on success

◆ ConvertColorRenderSpaceSRGBLinear() [1/4]

static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear ( cinema::BaseDocument doc,
Color color,
const LiteralId direction 
)
static

Convert a color between the render spaces and sRGB linear. It can be used on both direction.

Parameters
[in]docThe document to retrieve the converter.
[in]colorThe color to convert.
[in]directionThe direction of the conversion.

◆ ConvertColorRenderSpaceSRGBLinear() [2/4]

static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear ( cinema::BaseDocument doc,
Color32 color,
const LiteralId direction 
)
static

◆ ConvertColorRenderSpaceSRGBLinear() [3/4]

static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear ( cinema::BaseDocument doc,
ColorA color,
const LiteralId direction 
)
static

◆ ConvertColorRenderSpaceSRGBLinear() [4/4]

static MAXON_METHOD void ConvertColorRenderSpaceSRGBLinear ( cinema::BaseDocument doc,
ColorA32 color,
const LiteralId direction 
)
static