# IRsPrimitiveFactory Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | CreatePrimitive (IRsPrimitiveManager *pManager, IRsCommand **ppUndoRedoCmd, BSTR *pszScriptForm)
HRESULT | CreatePrimitivePreview (IRsPrimitiveManager *pManager)
HRESULT | GetTimestamps (RtDWORD *pdwMeshTs, RtDWORD *pdwMatrixTs, RtDWORD *pdwMaterialTs)
HRESULT | GetPreviewMesh (IRdMesh **ppMesh)
HRESULT | GetPreviewMatrix (IRdMatrixf **ppMatrix)
HRESULT | GetPreviewMaterial (IRdMaterialList **ppMaterial)
HRESULT | SetUserParameters (BSTR szParams)
HRESULT | Prepare ()

## Detailed Description

IRsPrimitiveFactory is an interface to factory that creates primitives according to input parameters.

## Member Function Documentation

HRESULT IRsPrimitiveFactory::CreatePrimitive | ( | IRsPrimitiveManager * | pManager,
|  | IRsCommand ** | ppUndoRedoCmd,
|  | BSTR * | pszScriptForm |
| ) |  |  |

Create primitive and return command for Undo/Redo and script form.

Parameters:

  | pManager | is manager used to create a primitive
  | ppUndoRedoCmd | is expected to be filled with command handling undo/redo actions for creating the primitive
  | pszScriptForm | should be filled with script form of primitive creation command.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRsPrimitiveFactory::CreatePrimitivePreview | ( | IRsPrimitiveManager * | pManager | ) |

Create primitive preview mesh.

Parameters:

  | pManager | is manager used to create a primitive preview

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRsPrimitiveFactory::GetTimestamps | ( | RtDWORD * | pdwMeshTs,
|  | RtDWORD * | pdwMatrixTs,
|  | RtDWORD * | pdwMaterialTs |
| ) |  |  |

Get mesh and matrix timestamps for mesh and matrix. Timestamps are used for caching; if value does not change between two calls than specified resource has not changed - and caller can assume that they have not changed.

Parameters:

  | pdwMeshTs | Mesh timestamp value. initial value is 0.
  | pdwMatrixTs. | Matrix timestamp value. Initial value is 0.
  | pdwMaterialTs. | Material timestamp value. Initial value is 0.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRsPrimitiveFactory::GetPreviewMesh | ( | IRdMesh ** | ppMesh | ) |

Return preview mesh.

Parameters:

  | ppMesh | is filled with preview mesh.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRsPrimitiveFactory::GetPreviewMatrix | ( | IRdMatrixf ** | ppMatrix | ) |

Return preview matrix.

Parameters:

  | ppMatrix | is filled with preview matrix.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRsPrimitiveFactory::GetPreviewMaterial | ( | IRdMaterialList ** | ppMaterial | ) |

Return preview material.

Parameters:

  | ppMaterial | is filled with preview material.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRsPrimitiveFactory::SetUserParameters | ( | BSTR | szParams | ) |

Set user parameters.

Parameters:

  | szParams | define additional user parameters defined through widget interface.

HRESULT IRsPrimitiveFactory::Prepare | ( |  | ) |

Set factory to initial state. Method is called when tool begins to create new primitive

Returns:
  standard HRESULT processing can be applied to returned value