Detailed Description
- See also:
- Loading and Saving,
Character Strings, Class
ISave, Class PostLoadCallback,
Class INode, Class
ClassDesc, Class
ClassDirectory, Class Interface.
- Description:
- This class provides methods to load data from disk and to
register post load callbacks.
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.
All methods of this class are implemented by the system.
#include <ioapi.h>
List of all members.
Public Types
|
enum |
BPFlag {
FORCEMERGE = (1<<0) } |
Public Member Functions
|
virtual |
~ILoad
() |
virtual void
* |
GetAddr
(int imaker)=0 |
virtual
void |
RecordBackpatch
(int imaker, void **patchThis, DWORD flags=0)=0 |
virtual
void |
SetRootAddr
(void *addr)=0 |
virtual void
* |
GetRootAddr
()=0 |
virtual
IOResult |
OpenChunk
()=0 |
virtual
USHORT |
CurChunkID
()=0 |
virtual
ChunkType |
CurChunkType
()=0 |
virtual
ULONGLONG |
CurChunkLength
()=0 |
virtual
int |
CurChunkDepth
()=0 |
virtual
IOResult |
CloseChunk
()=0 |
virtual
USHORT |
PeekNextChunkID
()=0 |
virtual
IOResult |
Read
(void *buf, ULONG nbytes, ULONG *nread)=0 |
virtual
IOResult |
ReadWStringChunk
(char **buf)=0 |
virtual
IOResult |
ReadWStringChunk
(mwchar_t **buf)=0 |
virtual
IOResult |
ReadCStringChunk
(char **buf)=0 |
virtual
IOResult |
ReadCStringChunk
(mwchar_t **buf)=0 |
virtual
void |
SetObsolete
()=0 |
virtual
void |
RegisterPostLoadCallback
(PostLoadCallback *cb)=0 |
virtual const
MCHAR * |
GetDir
(int which)=0 |
virtual
FileIOType |
DoingWhat
()=0 |
virtual
INode * |
RootNode
()=0 |
virtual
ClassDesc
* |
GetClassDesc
(USHORT refID) |
virtual
INT_PTR |
Execute
(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR
arg3=0) |
virtual
DWORD |
GetFileSaveVersion
() |
|
Retrieves the version and build number of
3ds Max used to save the file being loaded.
|
virtual
bool |
RecordNodeRefRemap
(ReferenceMaker
&aRefMaker, int aRefIdx, INode *aTargetNode, bool
aIsIndirectRef) |
|
Records information needed to remap a
reference to a node.
|
virtual const
MCHAR * |
FileName
() |
virtual
IOResult |
LoadAssetMetaData
() |
Member Enumeration Documentation
Constructor & Destructor Documentation
virtual ~ILoad |
( |
|
) |
[inline, virtual] |
Member Function Documentation
virtual void* GetAddr |
( |
int |
imaker |
) |
[pure virtual] |
- Parameters:
-
imaker |
This is the index returned from ISave::GetRefID().
that was used to save the pointer. |
virtual void RecordBackpatch |
( |
int |
imaker, |
|
|
void ** |
patchThis, |
|
|
DWORD |
flags = 0 |
|
) |
|
[pure virtual] |
- Parameters:
-
imaker |
This is the index returned from ISave::GetRefID(). |
patchThis |
This is a pointer to the pointer you want patched. |
flags |
This flag indicates that backpatches (and their subsequent
references) should be merged as well. |
virtual void SetRootAddr |
( |
void * |
addr |
) |
[pure virtual] |
virtual void* GetRootAddr |
( |
|
) |
[pure virtual] |
virtual IOResult
OpenChunk |
( |
|
) |
[pure virtual] |
- Returns:
- IO_OK - The result was acceptable - no errors.
IO_END - This is returned from ILoad::OpenChunk()
when the end of the chunks at a certain level have been reached. It
is used as a signal to terminates the processing of chunks at that
level.
IO_ERROR - This is returned if an error occurred. Note that
the plug-in should not put up a message box if a read error
occurred. It should simply return the error status. This prevents a
overabundance of messages from appearing.
virtual USHORT CurChunkID |
( |
|
) |
[pure virtual] |
virtual ChunkType CurChunkType |
( |
|
) |
[pure virtual] |
virtual ULONGLONG CurChunkLength |
( |
|
) |
[pure virtual] |
virtual int CurChunkDepth |
( |
|
) |
[pure virtual] |
virtual IOResult
CloseChunk |
( |
|
) |
[pure virtual] |
- Returns:
- A return value of IO_ERROR indicates there is no open
chunk to close; otherwise IO_OK.
virtual USHORT PeekNextChunkID |
( |
|
) |
[pure virtual] |
virtual IOResult
Read |
( |
void * |
buf, |
|
|
ULONG |
nbytes, |
|
|
ULONG * |
nread |
|
) |
|
[pure virtual] |
- Parameters:
-
buf |
A pointer to the buffer to read. |
nbytes |
The number of bytes to read. |
nread |
The number of bytes that were read. |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.
virtual IOResult
ReadWStringChunk |
( |
char ** |
buf |
) |
[pure virtual] |
- Parameters:
-
buf |
A pointer to an array of characters. |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.
virtual IOResult
ReadWStringChunk |
( |
mwchar_t ** |
buf |
) |
[pure virtual] |
- Parameters:
-
buf |
A pointer to an array of wide characters. |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.
virtual IOResult
ReadCStringChunk |
( |
char ** |
buf |
) |
[pure virtual] |
- Parameters:
-
buf |
A pointer to an array of single byte characters. This method
will allocate an internal buffer, stored in the ILoadImp class that
is big enough to hold the string chunk read in. You must then copy
or parse out the data and store it in your own area: you can't hang
on to the string pointer it hands back because it will not be
valid. |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.
virtual IOResult
ReadCStringChunk |
( |
mwchar_t ** |
buf |
) |
[pure virtual] |
- Parameters:
-
buf |
A pointer to an array of wide characters. This method will
allocate an internal buffer, stored in the ILoadImp class that is
big enough to hold the string chunk read in. You must then copy or
parse out the data and store it in your own area: you can't hang on
to the string pointer it hands back because it will not be
valid. |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.
virtual void SetObsolete |
( |
|
) |
[pure virtual] |
- Parameters:
-
cb |
Points to the callback object. |
virtual const MCHAR* GetDir |
( |
int |
which |
) |
[pure virtual] |
- Parameters:
-
which |
Specifies the directory name to retrieve. See MAX Directory IDs. The
constants are defined in MAXAPI.H |
- Returns:
- The name of the specified directory.
virtual FileIOType DoingWhat |
( |
|
) |
[pure virtual] |
- Returns:
- One of the following values:
IOTYPE_MAX
IOTYPE_MATLIB
virtual INode* RootNode |
( |
|
) |
[pure virtual] |
virtual ClassDesc* GetClassDesc |
( |
USHORT |
refID |
) |
[inline, virtual] |
- Parameters:
-
- Default Implementation:
- { return NULL; }
virtual INT_PTR Execute |
( |
int |
cmd, |
|
|
ULONG_PTR |
arg1 = 0 , |
|
|
ULONG_PTR |
arg2 = 0 , |
|
|
ULONG_PTR |
arg3 = 0 |
|
) |
|
[inline, virtual] |
virtual DWORD GetFileSaveVersion |
( |
|
) |
[inline, virtual] |
Retrieves the version and build number of 3ds Max used to save
the file being loaded.
Plugins can call this method when loading a max file is being
loaded.
- Returns:
- A value describing the version of 3ds Max used to save the
file. The value is composed of a LOWORD(value)= Build
number, and a HIWORD(value) = MAX_RELEASE. For
example, 41 for build #41, and 4000 for 3ds Max version 4.0
- Note:
- Plugins should not rely on the value returned by this function
for versioning their own data saved to the max file. Plugins should
rather use either:
- Parameter block versioning for versioning data stored in
parameter blocks. See IParamBlock2::GetVersion()
and the P_VERSION flag for versioning instances of class ParamBlockDesc2.
- Their own versioning scheme for data that is not stored in a
parameter block. Loading and saving a max file in the absence of
the plugin will maintain its data intact, but the max version and
build numbers will be updated, so next time the file is loaded in
the presence of the plugin, the max version number could be
different than when the plugin data was saved.
virtual bool RecordNodeRefRemap |
( |
ReferenceMaker & |
aRefMaker, |
|
|
int |
aRefIdx, |
|
|
INode * |
aTargetNode, |
|
|
bool |
aIsIndirectRef |
|
) |
|
[inline, virtual] |
Records information needed to remap a reference to a node.
References to nodes held by object-xrefed reference makers need
to be remapped when updating xref records. In most cases, Max will
automatically record data required to remap node references when
xrefing objects. Plug-ins that save node pointers into the max file
need to be modified to indirectly reference the node, in order for
that plug-in to be xref-able. For the legacy version of the plugin
to be xref-able, the plugin must record in a PostLoadCallback information
needed for remapping the indirect reference it makes to nodes. This
can be done by calling this method.
- Parameters:
-
aRefMaker |
- A scene entity that makes a reference to a node |
aRefIdx |
- The index of the reference aRefMaker makes to a node |
aTargetNode |
- The node being referenced |
aIsIndirectRef |
- If true, the reference to the node is indirect, otherwise
it's a regular reference |
- Returns:
- - true if a node-ref-remap entry was recorded successfully,
false otherwise
virtual const MCHAR* FileName |
( |
|
) |
[inline, virtual] |
virtual IOResult
LoadAssetMetaData |
( |
|
) |
[inline, virtual] |
- Returns:
- A return value of IO_ERROR indicates an error occurred,
otherwise IO_OK.