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

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
}

函数

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() .)

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.

参数
[in] lMessage The message: MATPREVIEW
[in] pData The message data.
[in] pUserData A clone of the user data.
返回
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); BaseContainer * data = mat-> GetDataInstance ();
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); }
参数
[in] pContainer The container of the node sent to NodeData::SetDParameter() . The caller owns the pointed container.
[in] pData The t_data sent to NodeData::SetDParameter() . The caller owns the pointed data.
[in] lFlags The flags sent to NodeData::SetDParameter() .
[in] lID The ID of the material preview.
返回
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( GeListNode *node, const DescID & id , GeData &t_data, DESCFLAGS_GET &flags) { BaseMaterial * mat = static_cast< BaseMaterial * > (node); BaseContainer * data = mat-> GetDataInstance (); 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); }
参数
[in] pContainer The container of the node sent to NodeData::GetDParameter() . The caller owns the pointed container.
[in] pData The t_data sent to NodeData::GetDParameter() . The caller owns the pointed data..
[in] lFlags The flags sent to NodeData::GetDParameter() .
[in] lID The ID of the material preview.
[in] lCount The dirty count.
[in] pMaterial The material. The caller owns the pointed material.
返回
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( GeListNode *node, const DescID & id , GeData &t_data, DESCFLAGS_GET &flags) { BaseShader * shd = static_cast< BaseMaterial * > (node); BaseContainer * data = shd-> GetDataInstance (); 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); }
参数
[in] pContainer The container of the node sent to NodeData::GetDParameter() . The caller owns the pointed container.
[in] pData The t_data sent to NodeData::GetDParameter() . The caller owns the pointed data..
[in] lFlags The flags sent to NodeData::GetDParameter() .
[in] lID The ID of the material preview.
[in] lCount The dirty count.
[in] pShader The shader. The caller owns the pointed shader.
返回
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.

参数
[in] bIncludeFlat2D Include Flat 2D.
[in] bIncludeDefault Include Default.
[in] lObjectID An object ID.
返回
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() .

参数
[in] lID The selected menu ID.
[out] t Assigned the preview type.
[out] strScene Assigned the scene name.
返回
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.

注意
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.
参数
[in] fn The user scene name.
[in] lID The material ID, or -1 to make the preview scene available for all materials.
[in] pstrName An optional user scene name. The string is copied. The caller owns the pointed string.
返回
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 .

BaseShader
定义: c4d_basechannel.h:35
GetDParameterPreview
Bool GetDParameterPreview(BaseContainer *pContainer, GeData *pData, DESCFLAGS_GET &lFlags, Int32 lID, Int32 lCount, BaseMaterial *pMaterial)
BaseList2D::GetDataInstance
const BaseContainer * GetDataInstance() const
定义: c4d_baselist.h:2283
DescID
定义: lib_description.h:327
NodeData::SetDParameter
virtual Bool SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
NodeData::GetDParameter
virtual Bool GetDParameter(GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags)
DESCFLAGS_GET
DESCFLAGS_GET
定义: ge_prepass.h:3099
GeListNode
Represents a C4DAtom that resides in a 4D list.
定义: c4d_baselist.h:1767
SetDParameterPreview
Bool SetDParameterPreview(BaseContainer *pContainer, const GeData *pData, DESCFLAGS_SET &lFlags, Int32 lID)
GeData
定义: c4d_gedata.h:82
DESCFLAGS_SET
DESCFLAGS_SET
定义: ge_prepass.h:3113
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53
BaseMaterial
定义: c4d_basematerial.h:27
BaseContainer
定义: c4d_basecontainer.h:46