customgui_matpreview.h File Reference

Classes

struct  MatPreviewObjectInfo
 
struct  MatPreviewModifyCacheScene
 
struct  MatPreviewPrepareScene
 
struct  MatPreviewGenerateImage
 
struct  MatPreviewCopyUserData
 
struct  MatPreviewHandleDragnDrop
 
class  MaterialPreviewData
 
class  MaterialPreviewCustomGui
 

Macros

#define CUSTOMGUI_MATPREVIEW
 
#define CUSTOMDATATYPE_MATPREVIEW
 
#define MATPREVIEW_MIN_WIDTH
 
#define MATPREVIEW_MIN_HEIGHT
 
#define MATPREVIEW_NO_SIZE_POPUP
 
#define MATPREVIEW_NO_BORDER
 
#define MATPREVIEW_NO_ANIMATION
 
#define MATPREVIEW_NO_FLOATWINDOW
 
#define MATPREVIEW_NO_SCENESETTINGS
 
#define MATPREVIEW_RECTSELECT
 
#define MATPREVIEW_NO_SCENESELECTION
 
#define MATPREVIEW_GET_OBJECT_INFO
 
#define MATPREVIEW_GENERATE_IMAGE
 
#define MATPREVIEW_MODIFY_CACHE_SCENE
 
#define MATPREVIEW_PREPARE_SCENE
 
#define MATPREVIEW_GET_PREVIEW_ID
 
#define MATPREVIEW_GET_POPUP_OPTIONS
 
#define MATPREVIEW_HANDLE_POPUP_MSG
 
#define MATPREVIEW_FREE_USERDATA
 
#define MATPREVIEW_COPY_USERDATA
 
#define MATPREVIEW_DRAGNDROP_RECV
 
#define MATPREVIEW_DRAGNDROP_START
 
#define MATPREVIEW_DRAGNDROP_END
 
#define MATPREVIEW_GET_DIRTY_COUNT
 
#define MATPREVIEW_POPUP_NAME
 
#define MATPREVIEW_NULL_SIZE_NAME
 
#define MATPREVIEW_FLAG_HIDE_ROTATION
 
#define MATPREVIEW_FLAG_HIDE_SCENES
 
#define MATPREVIEW_FLAG_HIDE_ANIMATE
 
#define MATPREVIEW_FLAG_HIDE_SIZE
 
#define MATPREVIEW_FLAG_HIDE_OPEN
 
#define MATPREVIEW_FLAG_HIDE_SCENE_SETTINGS
 
#define MATPREVIEW_FLAG_ALLOW_DRAGNDROP
 
#define RENDER_PREVIEW_USE_BMP_SIZE
 
#define RENDER_PREVIEW_USE_CURRENT_QUEUE
 

Typedefs

typedef Bool(* RenderPreviewImageCallback) (Int32 lMessage, void *pData, void *pUserData)
 

Enumerations

enum  MatPreviewType {
  MatPreviewDefault ,
  MatPreviewFlat2D ,
  MatPreviewCube ,
  MatPreviewPlane ,
  MatPreviewCylinder ,
  MatPreviewTorus ,
  MatPreviewPlaneBack ,
  MatPreviewSphere ,
  MatPreview2Torus ,
  MatPreviewRoundedCube ,
  MatPreviewKnot ,
  MatPreviewMultipleObjects ,
  MatPreviewCandle ,
  MatPreviewCloth ,
  MatPreviewGem ,
  MatPreviewObjectAnim ,
  MatPreviewObject ,
  MatPreviewUser
}
 
enum  MatPreviewSize {
  MatPreviewSizeDefault ,
  MatPreviewSizeSmall ,
  MatPreviewSizeMedium ,
  MatPreviewSizeBig ,
  MatPreviewSizeLarge
}
 

Functions

Bool SetDParameterPreview (BaseContainer *pContainer, const GeData *pData, DESCFLAGS_SET &lFlags, Int32 lID)
 
Bool GetDParameterPreview (BaseContainer *pContainer, GeData *pData, DESCFLAGS_GET &lFlags, Int32 lID, Int32 lCount, BaseMaterial *pMaterial)
 
Bool GetDParameterPreview (BaseContainer *pContainer, GeData *pData, DESCFLAGS_GET &lFlags, Int32 lID, Int32 lCount, BaseShader *pShader)
 
BaseContainer GetPreviewScenes (Bool bIncludeFlat2D, Bool bIncludeDefault=false, Int32 lObjectID=-1)
 
Bool HandlePreviewSceneMessage (Int32 lID, MatPreviewType &t, maxon::String &strScene)
 
Bool AddUserPreviewScene (const Filename &fn, Int32 lID, maxon::String *pstrName)
 
RENDERRESULT RenderMaterialPreview (const Filename &docpath, BaseMaterial *pMatClone, BaseMaterial *pOrigMat, BaseThread *pThread, BaseBitmap *pDest, BaseDocument *pOriginalDoc, Float rCurrentTime, Int32 lFlags=0)
 
RENDERRESULT RenderShaderPreview (const Filename &docpath, BaseShader *pShaderClone, BaseShader *pOrigShader, BaseThread *pThread, BaseBitmap *pDest, BaseDocument *pOriginalDoc, Float rCurrentTime, Int32 lFlags=0)
 
RENDERRESULT RenderCustomPreview (RenderPreviewImageCallback fn, void *pUserData, Int32 lUserID, BaseThread *pThread, BaseBitmap *pDest, Int32 lFlags=0)
 

Macro Definition Documentation

◆ CUSTOMGUI_MATPREVIEW

#define CUSTOMGUI_MATPREVIEW

Material preview custom GUI ID.

◆ CUSTOMDATATYPE_MATPREVIEW

#define CUSTOMDATATYPE_MATPREVIEW

Material preview custom data type ID.

◆ RENDER_PREVIEW_USE_BMP_SIZE

#define RENDER_PREVIEW_USE_BMP_SIZE

Renders in full bitmap size, ignoring the settings in the material or shader data. (For RenderMaterialPreview() and RenderShaderPreview().)

◆ RENDER_PREVIEW_USE_CURRENT_QUEUE

#define RENDER_PREVIEW_USE_CURRENT_QUEUE

Internal flag which tells the renderer to use the current destination queue RENDERFLAGS::INTERNAL_USE_CURRENT_QUEUE.

Typedef Documentation

◆ RenderPreviewImageCallback

typedef Bool(* RenderPreviewImageCallback) (Int32 lMessage, void *pData, void *pUserData)

Called to process host message for the MaterialPreviewData when initialized with this callback.

Parameters
[in]lMessageThe message: MATPREVIEW
[in]pDataThe message data.
[in]pUserDataA clone of the user data.
Returns
true if successful, otherwise false.

Function Documentation

◆ SetDParameterPreview()

Bool SetDParameterPreview ( BaseContainer pContainer,
const GeData pData,
DESCFLAGS_SET lFlags,
Int32  lID 
)

Convenience function to use in NodeData::SetDParameter() of nodes with a material preview in the description:

Bool SimpleMaterial::SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
{
BaseMaterial* mat = static_cast<BaseMaterial*>(node);
updatecount++;
switch (id[0].id)
{
case SIMPLEMATERIAL_MAT_PREVIEW:
return SetDParameterPreview(data, &t_data, flags, SIMPLEMATERIAL_MAT_PREVIEW);
}
return MaterialData::SetDParameter(node, id, t_data, flags);
}
PyCompilerFlags * flags
Definition: ast.h:14
Definition: c4d_basecontainer.h:48
const BaseContainer * GetDataInstance() const
Definition: c4d_baselist.h:2530
Definition: c4d_basematerial.h:28
Definition: lib_description.h:355
Definition: c4d_gedata.h:83
Represents a C4DAtom that resides in a 4D list.
Definition: c4d_baselist.h:1976
virtual Bool SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
Called to override the writing of parameters.
Bool SetDParameterPreview(BaseContainer *pContainer, const GeData *pData, DESCFLAGS_SET &lFlags, Int32 lID)
maxon::Bool Bool
Definition: ge_sys_math.h:51
DESCFLAGS_SET
Definition: ge_prepass.h:3369
struct _node node
Definition: node.h:10
Parameters
[in]pContainerThe container of the node sent to NodeData::SetDParameter(). The caller owns the pointed container.
[in]pDataThe t_data sent to NodeData::SetDParameter(). The caller owns the pointed data.
[in]lFlagsThe flags sent to NodeData::SetDParameter().
[in]lIDThe ID of the material preview.
Returns
true if successful, otherwise false.

◆ GetDParameterPreview() [1/2]

Bool GetDParameterPreview ( BaseContainer pContainer,
GeData pData,
DESCFLAGS_GET lFlags,
Int32  lID,
Int32  lCount,
BaseMaterial pMaterial 
)

Convenience function to use in NodeData::GetDParameter() of material nodes with a material preview in the description:

Bool SimpleMaterial::GetDParameter(const GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) const
{
BaseMaterial* mat = static_cast<BaseMaterial*>(node);
switch (id[0].id)
{
case SIMPLEMATERIAL_MAT_PREVIEW:
return GetDParameterPreview(data, &t_data, flags, SIMPLEMATERIAL_MAT_PREVIEW, updatecount, mat);
}
return MaterialData::GetDParameter(node, id, t_data, flags);
}
virtual Bool GetDParameter(const GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) const
Bool GetDParameterPreview(BaseContainer *pContainer, GeData *pData, DESCFLAGS_GET &lFlags, Int32 lID, Int32 lCount, BaseMaterial *pMaterial)
DESCFLAGS_GET
Definition: ge_prepass.h:3354
Parameters
[in]pContainerThe container of the node sent to NodeData::GetDParameter(). The caller owns the pointed container.
[in]pDataThe t_data sent to NodeData::GetDParameter(). The caller owns the pointed data..
[in]lFlagsThe flags sent to NodeData::GetDParameter().
[in]lIDThe ID of the material preview.
[in]lCountThe dirty count.
[in]pMaterialThe material. The caller owns the pointed material.
Returns
true if successful, otherwise false.

◆ GetDParameterPreview() [2/2]

Bool GetDParameterPreview ( BaseContainer pContainer,
GeData pData,
DESCFLAGS_GET lFlags,
Int32  lID,
Int32  lCount,
BaseShader pShader 
)

Convenience function to use in NodeData::GetDParameter() of shader nodes with a material preview in the description:

Bool SimpleShader::GetDParameter(const GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) const
{
BaseShader* shd = static_cast<BaseMaterial*>(node);
switch (id[0].id)
{
case SIMPLEMATERIAL_MAT_PREVIEW:
return GetDParameterPreview(data, &t_data, flags, SIMPLEMATERIAL_MAT_PREVIEW, updatecount, shd);
}
return ShaderData::GetDParameter(node, id, t_data, flags);
}
Definition: c4d_basechannel.h:36
Parameters
[in]pContainerThe container of the node sent to NodeData::GetDParameter(). The caller owns the pointed container.
[in]pDataThe t_data sent to NodeData::GetDParameter(). The caller owns the pointed data..
[in]lFlagsThe flags sent to NodeData::GetDParameter().
[in]lIDThe ID of the material preview.
[in]lCountThe dirty count.
[in]pShaderThe shader. The caller owns the pointed shader.
Returns
true if successful, otherwise false.

◆ GetPreviewScenes()

BaseContainer GetPreviewScenes ( Bool  bIncludeFlat2D,
Bool  bIncludeDefault = false,
Int32  lObjectID = -1 
)

Retrieves a list of preview scenes. Use the returned container's elements in menus.

Parameters
[in]bIncludeFlat2DInclude Flat 2D.
[in]bIncludeDefaultInclude Default.
[in]lObjectIDAn object ID.
Returns
The generated menu container.

◆ HandlePreviewSceneMessage()

Bool HandlePreviewSceneMessage ( Int32  lID,
MatPreviewType t,
maxon::String strScene 
)

Generates the type and the scene name from the menu item generated by GetPreviewScenes().

Parameters
[in]lIDThe selected menu ID.
[out]tAssigned the preview type.
[out]strSceneAssigned the scene name.
Returns
true if successful, otherwise false.

◆ AddUserPreviewScene()

Bool AddUserPreviewScene ( const Filename fn,
Int32  lID,
maxon::String pstrName 
)

Adds a user scene that optionally only shows up in materials with type lID. The pstrName may be nullptr, in which case the file name is used.

Note
The scene has to contain an object named "Object" (which may well be a Null containing a group of objects) in order to be used by this function.
Parameters
[in]fnThe user scene name.
[in]lIDThe material ID, or -1 to make the preview scene available for all materials.
[in]pstrNameAn optional user scene name. The string is copied. The caller owns the pointed string.
Returns
true if successful, otherwise false.

◆ RenderMaterialPreview()

RENDERRESULT RenderMaterialPreview ( const Filename docpath,
BaseMaterial pMatClone,
BaseMaterial pOrigMat,
BaseThread pThread,
BaseBitmap pDest,
BaseDocument pOriginalDoc,
Float  rCurrentTime,
Int32  lFlags = 0 
)

Called by Cinema 4D to calculate the material preview for the Material Manager. Private.

◆ RenderShaderPreview()

RENDERRESULT RenderShaderPreview ( const Filename docpath,
BaseShader pShaderClone,
BaseShader pOrigShader,
BaseThread pThread,
BaseBitmap pDest,
BaseDocument pOriginalDoc,
Float  rCurrentTime,
Int32  lFlags = 0 
)

Called by Cinema 4D to calculate the shader preview for the Material Manager. Private.

◆ RenderCustomPreview()

RENDERRESULT RenderCustomPreview ( RenderPreviewImageCallback  fn,
void *  pUserData,
Int32  lUserID,
BaseThread pThread,
BaseBitmap pDest,
Int32  lFlags = 0 
)

Called by Cinema 4D to calculate a custom preview. Private.