Detailed Description
- See also:
- Loading and Saving,
Character Strings, Class
ILoad, Class
ClassDesc, Class
ClassDirectory, Class Interface.
- Description:
- This class provides methods to save data to disk.
Note: It is not valid, to write two CStrs in the same chunk of a 3ds Max
file, since ILoad::ReadCStringChunk()
sets the size for the string to the ChunkSize. However it is
possible to write other data, such as two ints, into the same
chunk.
Note about member alignment: Please make sure that when you save
data from your plugin you save individual data members using a
chunk ID instead of saving the image of a class. Saving (and
loading) a class image puts you at risk of running into member
alignment problems and as such could potentially corrupt saved
files. File IO would be put further at risk when you keep Intel's
IA-64 architecture in mind which depends on member alignment. What
you should not do is outlined in the following example when loading
a class image; iload->Read(&myclass, sizeof(MyClass),
&ab);
Once you change the class in such a way that it affects the data
size you run the risk of having to support different versions, file
IO incompatibility, and member alignment issues.
The following global function is not part of this class but is
available for use:
#include <ioapi.h>
List of all members.
Constructor & Destructor Documentation
virtual ~ISave |
( |
|
) |
[inline, virtual] |
Member Function Documentation
virtual int GetRefID |
( |
void * |
ptarg |
) |
[pure virtual] |
- Parameters:
-
ptarg |
The pointer to save. |
- Returns:
- The id that may be saved to disk.
virtual void BeginChunk |
( |
USHORT |
id |
) |
[pure virtual] |
virtual void EndChunk |
( |
|
) |
[pure virtual] |
virtual int CurChunkDepth |
( |
|
) |
[pure virtual] |
virtual IOResult
Write |
( |
const void * |
buf, |
|
|
ULONG |
nbytes, |
|
|
ULONG * |
nwrit |
|
) |
|
[pure virtual] |
- Parameters:
-
buf |
The buffer to write. |
nbytes |
The number of bytes to write. |
nwrit |
The number of bytes actually written. |
- Returns:
- IO_OK - The write was acceptable - no errors.
IO_ERROR - This is returned if an error occurred. Note that
the plug-in should not put up a message box if a write error
occurs. It should simply return the error status. This prevents a
overabundance of messages from appearing.
virtual IOResult
WriteWString |
( |
const char * |
str |
) |
[pure virtual] |
- Parameters:
-
- Returns:
- IO_OK - The write was acceptable - no errors.
IO_ERROR - This is returned if an error occurred.
virtual IOResult
WriteWString |
( |
const mwchar_t * |
str |
) |
[pure virtual] |
- Parameters:
-
- Returns:
- IO_OK - The write was acceptable - no errors.
IO_ERROR - This is returned if an error occurred.
virtual IOResult
WriteCString |
( |
const char * |
str |
) |
[pure virtual] |
- Parameters:
-
- Returns:
- IO_OK - The write was acceptable - no errors.
IO_ERROR - This is returned if an error occurred.
virtual IOResult
WriteCString |
( |
const mwchar_t * |
str |
) |
[pure virtual] |
- Parameters:
-
- Returns:
- IO_OK - The write was acceptable - no errors.
IO_ERROR - This is returned if an error occurred.
virtual FileIOType DoingWhat |
( |
|
) |
[pure virtual] |
- Returns:
- One of the following values:
IOTYPE_MAX
IOTYPE_MATLIB
virtual DWORD SavingVersion |
( |
|
) |
[inline, virtual] |
- See also:
- GetSavingVersion(), 3dsMaxRelease
virtual USHORT GetClassDescID |
( |
ReferenceMaker * |
rm |
) |
[inline, virtual] |
- Parameters:
-
rm |
Points to the reference maker. |
- Default Implementation:
- { return 0xffff; }
{ return NO_CLASSDESC_ID_RETURNED; }
virtual INT_PTR Execute |
( |
int |
cmd, |
|
|
ULONG_PTR |
arg1 = 0 , |
|
|
ULONG_PTR |
arg2 = 0 , |
|
|
ULONG_PTR |
arg3 = 0 |
|
) |
|
[inline, virtual] |
virtual const MCHAR* FileName |
( |
|
) |
[inline, virtual] |
- Parameters:
-
assetId |
The id for the asset. |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.
virtual bool SaveAssetAsAssetIDGuid |
( |
|
) |
[inline, virtual] |
- Returns:
- A return value of true indicates to store eassets as guids,
otherwise as the asset filename.