MaterialPreviewData Class Reference

#include <customgui_matpreview.h>

Inheritance diagram for MaterialPreviewData:

Detailed Description

Material preview data type (CUSTOMDATATYPE_MATPREVIEW) for MaterialPreviewCustomGui.

Public Member Functions

void AnimatePreview (Bool bAnimate)
 
Bool PreviewIsAnimated ()
 
void SetPreviewType (MatPreviewType t)
 
MatPreviewType GetPreviewType ()
 
void SetUserPreviewSceneName (const maxon::String &strName)
 
String GetUserPreviewSceneName ()
 
void SetPreviewSize (MatPreviewSize s)
 
MatPreviewSize GetPreviewSize ()
 
void SetObjectMatrix (const Matrix &m)
 
Bool GetObjectMatrix (Matrix &m)
 
void ClearObjectMatrix ()
 
Float GetWorldSize ()
 
void SetWorldSize (Float r)
 
Float GetPreviewStartTime ()
 
void SetPreviewStartTime (Float r)
 
void GetEnvironment (Vector &col, Float &strength)
 
void SetEnvironment (const Vector &col, const Float &strength)
 
Int32 GetDirtyCount ()
 
Bool GetRegion (Float &l, Float &t, Float &r, Float &b)
 
void SetRegion (Bool bActive, Float l, Float t, Float r, Float b)
 
Int32 GetPreviewChannel ()
 
void SetPreviewChannel (Int32 lChannel)
 
Int32 GetReflectionLayer ()
 
void SetReflectionLayer (Int32 lLayer)
 

Private Member Functions

 MaterialPreviewData ()
 
 ~MaterialPreviewData ()
 

Init

Bool Init (BaseChannel *pChannel, Int32 lCount)
 
Bool Init (BaseShader *pShader, Int32 lCount)
 
Bool Init (BaseMaterial *pMaterial, Int32 lCount)
 
Bool Init (BaseBitmap *pImage, Int32 lCount)
 
Bool Init (RenderPreviewImageCallback fn, void *pUserData, Int32 lUserID, Int32 lCount)
 

Constructor & Destructor Documentation

◆ MaterialPreviewData()

MaterialPreviewData ( )
private

◆ ~MaterialPreviewData()

~MaterialPreviewData ( )
private

Member Function Documentation

◆ Init() [1/5]

Bool Init ( BaseChannel pChannel,
Int32  lCount 
)

Initializes the material preview with pChannel.

Parameters
[in]pChannelThe initial preview source. The caller owns the pointed channel.
[in]lCountThe dirty count. Used to detect changes.
Returns
true if successful, otherwise false.

◆ Init() [2/5]

Bool Init ( BaseShader pShader,
Int32  lCount 
)

Initializes the material preview with pShader.

Parameters
[in]pShaderThe initial preview source. The caller owns the pointed shader.
[in]lCountThe dirty count. Used to detect changes.
Returns
true if successful, otherwise false.

◆ Init() [3/5]

Bool Init ( BaseMaterial pMaterial,
Int32  lCount 
)

Initializes the material preview with pMaterial.

Parameters
[in]pMaterialThe initial preview source. The caller owns the pointed material.
[in]lCountThe dirty count. Used to detect changes.
Returns
true if successful, otherwise false.

◆ Init() [4/5]

Bool Init ( BaseBitmap pImage,
Int32  lCount 
)

Initializes the material preview with pImage.

Parameters
[in]pImageThe initial preview source. The caller owns the pointed bitmap.
[in]lCountThe dirty count. Used to detect changes.
Returns
true if successful, otherwise false.

◆ Init() [5/5]

Bool Init ( RenderPreviewImageCallback  fn,
void *  pUserData,
Int32  lUserID,
Int32  lCount 
)

Initializes the material preview with a custom image hook. The hook will handle all host messages.

Parameters
[in]fnThe callback for the preview.
[in]pUserDataThe user data. Passed along to the hook. May be deleted after the function has finished.
[in]lUserIDA user ID for the material preview. Used to identify the callback.
[in]lCountThe dirty count. Increment this whenever a parameter has been changed.
Returns
true if successful, otherwise false.

◆ AnimatePreview()

void AnimatePreview ( Bool  bAnimate)

Sets the preview animation state.

Parameters
[in]bAnimateThe new animation state.

◆ PreviewIsAnimated()

Bool PreviewIsAnimated ( )

Checks the preview animation state.

Returns
The preview animation state.

◆ SetPreviewType()

void SetPreviewType ( MatPreviewType  t)

Sets the preview type.

Parameters
[in]tThe new preview type: MatPreviewType

◆ GetPreviewType()

MatPreviewType GetPreviewType ( )

Checks the preview type.

Returns
The preview type: MatPreviewType

◆ SetUserPreviewSceneName()

void SetUserPreviewSceneName ( const maxon::String strName)

Sets the user preview scene name.

Parameters
[in]strNameThe new user preview scene name.

◆ GetUserPreviewSceneName()

String GetUserPreviewSceneName ( )

Retrieves the user preview scene name.

Returns
The user preview scene name.

◆ SetPreviewSize()

void SetPreviewSize ( MatPreviewSize  s)

Sets the preview size.

Parameters
[in]sThe new preview size: MatPreviewSize

◆ GetPreviewSize()

MatPreviewSize GetPreviewSize ( )

Retrieves the preview size.

Returns
The preview size.

◆ SetObjectMatrix()

void SetObjectMatrix ( const Matrix m)

Sets the object matrix.

Parameters
[in]mThe new object matrix.

◆ GetObjectMatrix()

Bool GetObjectMatrix ( Matrix m)

Retrieves the object matrix.

Parameters
[out]mAssigned the object matrix, if not cleared.
Returns
true if successful, false if the object matrix is not initialized.

◆ ClearObjectMatrix()

void ClearObjectMatrix ( )

Clears the object matrix, i.e to an uninitialized state.

◆ GetWorldSize()

Float GetWorldSize ( )

Retrieves the world size.

Returns
The world size.

◆ SetWorldSize()

void SetWorldSize ( Float  r)

Sets the world size.

Parameters
[in]rThe new world size.

◆ GetPreviewStartTime()

Float GetPreviewStartTime ( )

Retrieves the preview start time.

Returns
The preview start time.

◆ SetPreviewStartTime()

void SetPreviewStartTime ( Float  r)

Sets the preview start time.

Parameters
[in]rThe new start time.

◆ GetEnvironment()

void GetEnvironment ( Vector col,
Float strength 
)

Gets the environment data.

Parameters
[out]colAssigned the environment color.
[out]strengthAssigned the environment strength.

◆ SetEnvironment()

void SetEnvironment ( const Vector col,
const Float strength 
)

Sets the environment data.

Parameters
[in]colThe new environment color.
[in]strengthThe new environment strength.

◆ GetDirtyCount()

Int32 GetDirtyCount ( )

Retrieves the dirty count for the preview.

Returns
The dirty count.

◆ GetRegion()

Bool GetRegion ( Float l,
Float t,
Float r,
Float b 
)

Retrieves the current selection region.

Parameters
[out]lAssigned the left boundary, between 0 and 1.
[out]tAssigned the top boundary, between 0 and 1.
[out]rAssigned the right boundary, between 0 and 1.
[out]bAssigned the bottom boundary, between 0 and 1.
Returns
true if the region could be retrieved, otherwise false.

◆ SetRegion()

void SetRegion ( Bool  bActive,
Float  l,
Float  t,
Float  r,
Float  b 
)

Sets a selection region in the preview.

Parameters
[in]bActiveDetermines if the rectangle is active or not.
[in]lThe new left boundary, between 0 and 1.
[in]tThe new top boundary, between 0 and 1.
[in]rThe new right boundary, between 0 and 1.
[in]bThe new bottom boundary, between 0 and 1.

◆ GetPreviewChannel()

Int32 GetPreviewChannel ( )

Retrieves the channel used for preview.

Returns
The channel: CHANNEL

◆ SetPreviewChannel()

void SetPreviewChannel ( Int32  lChannel)

Sets the channel used for preview.

Parameters
[in]lChannelThe new channel: CHANNEL

◆ GetReflectionLayer()

Int32 GetReflectionLayer ( )

Retrieves the reflection layer used for preview.

Since
R16
Returns
The reflection layer ID or NOTOK if unset.

◆ SetReflectionLayer()

void SetReflectionLayer ( Int32  lLayer)

Sets the reflection layer used for preview.

Note
Suited to test a specific reflectance layer. This disables several material properties in the preview like color and transparency. It also only shows the effect of the reflectance layer with ID lLayer if any.
Make sure to check the layer with ID lLayer exists before setting this, otherwise one may get a pure-black material preview.
Keep always in mind that reflection layers can be removed any time (both by user and via API), therefore a specific layer ID could be no longer valid.
Since
R16
Parameters
[in]lLayerThe reflection layer ID to set. Pass NOTOK to revert back to normal behavior i.e. to show all material properties and all reflection layers.