Public Member Functions

ITargetedIO Class Reference

Search for all occurrences

Detailed Description

See also:
Class Renderer
Description:
The TargetedIO system is useful for renderers that wish to implement custom Render Preset categories. The Mental Ray categories "Processing" and "Illumination" are an example. TargetedIO is NOT important to developers who wish only to load and save render presets, and are not implementing their own renderer.

Abstractly, ITargetedIO represents a subset of the current scene, a "targeted" set of parameters, to be saved as a preset. Render Preset files are stored in the same format as .max files, but contain only the target parts of the scene, namely the renderer's parameters.

In practice, an ITargetedIO instance is passed to the renderer when presets are saved and loaded. The renderer filters what is saved and loaded by interacting with this IO object.

#include <iTargetedIO.h>

Inheritance diagram for ITargetedIO:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void  AddSaveTarget (int targetIndex, ReferenceTarget *rt)=0
  This is used when a preset is saved.
virtual ReferenceTarget GetSaveTarget (int targetIndex)=0
  This is used when a preset is loaded.
virtual int  SaveToFile (const MCHAR *fileName, FileIOType context)=0
  This is used internally and should not be called by developers.
virtual int  SaveToFile (MCHAR *fileName, FileIOType context)
virtual int  LoadFromFile (const MCHAR *fileName, FileIOType context)=0
  This is used internally and should not be called by developers.
virtual int  LoadFromFile (MCHAR *fileName, FileIOType context)
virtual void  Store (int targetIndex, ReferenceTarget *rt)=0
  Allows the renderer to preserve a ReferenceTarget object before a preset is loaded.
virtual ReferenceTarget Retrieve (int targetIndex)=0
  returns a referenceTarget that was previously saved with Store().

Member Function Documentation

virtual void AddSaveTarget ( int  targetIndex,
ReferenceTarget rt 
) [pure virtual]

This is used when a preset is saved.

It is possible for the user to choose some categories for the preset without selecting the renderer itself. In this case the renderer is NOT part of the preset and its Load() method is not called when the preset is loaded. Other categories defined by the renderer might still be saved in the preset. For this reason, it is important that each category be separate a ReferenceTarget with its own Load() and Save().

Parameters:
targetIndex - a category ID number as determined by the renderer.
rt - the object which embodies this category of parameters.
virtual ReferenceTarget* GetSaveTarget ( int  targetIndex ) [pure virtual]

This is used when a preset is loaded.

The renderer can then copy this loaded set of parameters into its own active set. As described above, the renderer might not have its Load() method called when the preset is loaded, so so the renderer must take responsibility to call GetSaveTarget() and manually copy its parameters out of this object.

Parameters:
targetIndex - A category ID number as determined by the renderer.
Returns:
the ReferenceTarget that was loaded under that category.
virtual int SaveToFile ( const MCHAR *  fileName,
FileIOType  context 
) [pure virtual]

This is used internally and should not be called by developers.

virtual int SaveToFile ( MCHAR *  fileName,
FileIOType  context 
) [inline, virtual]
Deprecated:
Implement SaveToFile( const MCHAR * fileName, FileIOType context )
{ return SaveToFile(const_cast<const MCHAR*>(fileName), context); }
virtual int LoadFromFile ( const MCHAR *  fileName,
FileIOType  context 
) [pure virtual]

This is used internally and should not be called by developers.

virtual int LoadFromFile ( MCHAR *  fileName,
FileIOType  context 
) [inline, virtual]
virtual void Store ( int  targetIndex,
ReferenceTarget rt 
) [pure virtual]

Allows the renderer to preserve a ReferenceTarget object before a preset is loaded.

these utility methods can be used by renderers to hang on to reference targets between the RenderPresetsPreLoad and RenderPresetsPostLoad calls. This is needed when the user has chosen to save the renderer in the preset, but NOT all of its parameters. In this case the renderer's Load() will be called which may result in loading parameters that the user did not want as part of the preset. If the renderer sees that a certain category is not being loaded, it can Store() that object before the load and Retrieve() it afterwards, restoring its active set of parameters to their correct value.

Parameters:
targetIndex - A category ID number as determined by the renderer.
rt - the object which embodies this category of parameters.
virtual ReferenceTarget* Retrieve ( int  targetIndex ) [pure virtual]

returns a referenceTarget that was previously saved with Store().

these utility methods can be used by renderers to hang on to reference targets between the RenderPresetsPreLoad and RenderPresetsPostLoad calls.

Parameters:
targetIndex - A category ID number as determined by the renderer.
Returns:
the object which embodies this category of parameters.

ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO
ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO ITargetedIO